parsevolume: fix escape guard and option normalization - #7035
Open
vtushar06 wants to merge 2 commits into
Open
Conversation
The escape guard tests idx-1 > 0, which excludes index 1, so a volume starting with an escaped colon is split on that colon anyway: \:foo:/dst gives ["\", "foo", "/dst"] instead of [":foo", "/dst"]. Not reachable from the CLI today since the host path has to be absolute, so this is correctness rather than a live bug. The package had no tests at all, so add the first ones alongside. Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
Volume() throws away the normalized slice ValidateVolumeOpts returns, so the cached and delegated options that function is documented to drop silently still reach mount.Options. With no options at all, splitting an empty string left mount.Options as [""] rather than empty. Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
vtushar06
force-pushed
the
parsevolume-fixes
branch
from
August 14, 2026 13:56
27ece27 to
d0359e8
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.
I was reading the volume parser and noticed the escape guard in
SplitStringWithColonEscapechecksidx-1 > 0, which excludes index 1, so a volume starting with an escaped colon gets split on it anyway:Mid-string escapes are unaffected. I don't think this is reachable from the CLI today since the host path has to be absolute, so I am pitching it as correctness plus coverage, not a live bug.
While writing tests for it I also noticed Volume() discards the normalized slice ValidateVolumeOpts returns, so the cached/delegated options that function is documented to silently drop still end up in
mount.Options, and with no options at all mount.Options comes back as [""] instead of empty.so the package had no tests, so both commits bring their own here
cc @lsm5