Repository navigation
format: read a volume named with a single letter as a named volume - #972
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Windows bind mounts with unresolved target expressions can be misclassified as named volumes, silently losing the intended target.
1 open issue
What changed in this PR
This PR updates Compose short-syntax volume parsing so single-letter names are recognized as named volumes while preserving common Windows drive-path forms.
Changes:
- Distinguishes single-letter volume names from Windows drive paths.
- Adds parser and loader regression coverage.
- Expands fuzz round-trip checks to include single-letter sources and targets.
| File | Description |
|---|---|
loader/tests/volumes_test.go |
Adds service and job conformance cases for volume names and Windows paths. |
format/volume.go |
Adds drive-path and named-volume disambiguation logic. |
format/volume_test.go |
Covers single-letter names, targets, and Windows drive forms. |
format/volume_fuzz_test.go |
Removes single-letter exclusions and adds regression seeds. |
Review effort: Balanced
A single letter followed by a colon was always taken for a Windows drive, so `a:/data` became an anonymous volume at `a:/data` and `a:/data:ro` a bind mount of `a:/data` on `ro`, on any platform. The letter is now a drive only when a path separator follows: always for a backslash, and for a slash unless the spec reads as a named volume (a single section after the path, not a target). `C:\data:/data` and `C:/data:/data` keep binding the drive. The fuzzer no longer skips the volumes with a single letter source or target. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
ndeloof
force-pushed
the
parse-volume-single-letter
branch
from
October 25, 2026 08:45
2ee2f55 to
7bd8c75
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.

What this PR does, in one sentence
A volume named with a single letter (
a:/data) is read as a named volume again, instead of being mistaken for a Windows drive.Context
ParseVolumetakes a single letter followed by a colon for a Windows drive, whatever the platform. A Compose file such asloads, on Linux and macOS too, as an anonymous volume mounted at
a:/data, andb:/logs:roas a bind mount ofb:/logson a target namedro. Docker then rejects the project, although a one-letter volume name is valid. The same reading madeServiceVolumeConfig.String(), documented as parseable back, unable to round trip as soon as a source or a target tied in one letter (x:y:ro,/data:a:ro).What the PR brings
A single letter ends a Windows drive only when a path separator follows the colon:
C:\data:/datais a bind mount of the drive, as before;C:/data:/data,C:/data:/data:roandC:/data:d:\dataare too: a target after the path, or more sections, can only be a bind mount from the drive;a:/data,a:/data:roanda:bare a named volumea, as the Linux and macOS Docker parsers read them.One form is inherently ambiguous without knowing the platform: a bare
C:/data, an anonymous volume on a Windows container path, now reads as the volumeCmounted at/data(with a backslash,C:\datais unchanged).The short syntax is covered by a conformance test in
loader/testsand by table tests informat, andFuzzParseVolumeno longer skips the volumes with a single letter source or target.🤖 Generated with Claude Code