Fix Bind.parse for Windows drive paths written with forward slashes - #2652
Open
Develop-KIM wants to merge 1 commit into
Open
Fix Bind.parse for Windows drive paths written with forward slashes#2652Develop-KIM wants to merge 1 commit into
Develop-KIM wants to merge 1 commit into
Conversation
Bind.parse split the spec on ':' unless the colon was followed by a backslash, so a Windows drive path written with forward slashes (e.g. "C:/host:/container:rw") was split at the drive-letter colon and either mis-parsed or rejected with IllegalArgumentException. Add a negative lookbehind so a leading "<letter>:" is not treated as a separator, covering both backslash and forward-slash drive paths. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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
Bind.parsesplits the spec on:unless the colon is followed by a backslash, which handles Windows paths written asC:\host:/container. But a Windows drive path written with forward slashes (C:/host:/container) has a drive-letter colon that isn't followed by a backslash, so it gets treated as a separator:Docker itself accepts drive paths with either slash direction, so
C:/...binds should parse the same asC:\....Fix
Add a negative lookbehind so a leading
<letter>:is not treated as a separator:Existing backslash paths are unaffected (their drive colon is still skipped by the
(?!\\)lookahead).Tests
Added three cases to
BindTestfor forward-slash drive paths (default /rw/ro,z). FullBindTest(41 tests) passes and the reactor build is green.Note
One intentional behavior change: a bare
a:b(single-letter relative host path) now parses as a drive prefix and is rejected, matching how Docker treats a leading<letter>:. Happy to adjust the scope if you'd prefer it narrower.This was written with AI assistance (Claude); I've reviewed the change and tested it locally.