Anchor VERSION match on the Docker epoch to avoid distro-version hits - #571
Open
fudianchn wants to merge 1 commit into
Open
Anchor VERSION match on the Docker epoch to avoid distro-version hits#571fudianchn wants to merge 1 commit into
fudianchn wants to merge 1 commit into
Conversation
|
这是一封自动回复邮件。已经收到您的来信,我会尽快回复。
|
… hits The apt madison grep matched VERSION anywhere in the package line, so on Ubuntu noble `VERSION=24.0` matched the `24.04` in `5:28.4.0-1~ubuntu.24.04~noble` and installed the latest (28.4.0) instead of the requested 24.0 (or a clean "not found"). (docker#526) Anchor the grep on the Docker epoch ("5:") so it matches the package version field (`5:<version>-...`), not the distro version embedded in the release suffix. Applied to both docker-ce and docker-ce-cli lookups. Closes docker#526 Signed-off-by: 付典 <fudianchn@gmail.com>
fudianchn
force-pushed
the
fix-version-selection-distro-match
branch
from
August 9, 2026 01:10
037c57c to
5a33dc2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Ubuntu noble,
VERSION=24.0installs the latest Docker (28.4.0) instead of the requested 24.0 (#526):The grep matches
VERSIONanywhere in the madison line, so24.0matches the24.04in5:28.4.0-1~ubuntu.24.04~noble, andhead -1then resolves to 28.4.0.Fix
Anchor the grep on the Docker epoch (
5:) so it matches the package version field (5:<version>-...) rather than the distro version embedded in the release suffix:Applied to both the
docker-ceanddocker-ce-clilookups. Docker packages consistently use the5:epoch, so this reliably binds the match to the version.Verification
Simulated
apt-cache madison docker-ceoutput (noble) with both 28.4.0 and 24.0.2 present,VERSION=24.0:grep '24.0'(before)5:28.4.0-1~ubuntu.24.04~noble← wrong (matched 24.04)grep '5:24.0'(after)5:24.0.2-1~ubuntu.24.04~noble← correctAnd when 24.0 is genuinely unavailable,
grep '5:24.0'matches nothing → the script hits its existingERROR: '$VERSION' not found amongst apt-cache madison resultspath and exits 1, instead of silently installing the latest.bash -n install.shpasses.Closes #526