Repository navigation
fix: only rewrite whole Windows reserved device names - #2704
Open
Pranav-IIITM wants to merge 1 commit into
Open
Pranav-IIITM wants to merge 1 commit into
Pranav-IIITM wants to merge 1 commit into
Conversation
FilterReservedNames matched reserved words (aux, com, con, lpt, nul, prn) as substrings and ran on every OS, so valid names were mangled (e.g. "my-company-cache" -> "my-c_o_mpany-cache", "config" -> "c_o_nfig"), including on Linux and macOS where nothing is reserved. This changed Docker cache volume names away from what users requested. Match only the whole base name, case-insensitively, against the actual Windows reserved set (CON, PRN, AUX, NUL, COM1-COM9, LPT1-LPT9), handle names with an extension such as "nul.txt", and skip the transformation entirely on non-Windows platforms. Signed-off-by: Pranav-IIITM <jogdandpranav2007@gmail.com>
This branch has not been deployed
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.
Summary
paths.FilterReservedNamesrewrote valid names because it matched the Windows reserved words (aux,com,con,lpt,nul,prn) as substrings, and it ran on every OS. As a result, ordinary names were mangled — including on Linux and macOS, where no names are reserved — which changed the Docker cache volume names users actually asked for.Before / After
What changed
.), case-insensitively, instead of matching a reserved word anywhere in the string.CON,PRN,AUX,NUL,COM1–COM9,LPT1–LPT9. Barecom/lptare no longer rewritten, since they are not actually reserved.nul.txtbecomesn_u_l.txt.Impact
docker volume lsand via scripting.my-company-cache) is no longer missed.Migration note
Existing incorrectly mangled volumes are not renamed automatically. After upgrading, pack may reference a new, correctly named volume while the old mangled volume remains until it is cleaned up manually.
Testing
go build ./internal/paths/...go vet ./internal/paths/go test ./internal/paths/... ./pkg/cache/...Closes #2703