[Bug]: --mount rejects a directive whose value contains "="
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 85/100
Research direction
Start at Parser.mount in Sources/Services/ContainerAPIService/Client/Parser.swift around line 371, then reproduce the issue with the provided container run command. Verify that a mount source or destination containing an equals sign is accepted as one value and that the existing invalid-directive behavior remains intact.
Written by the indexing model from the issue text.
Description
I have done the following
- I have searched the existing issues
- If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce
Run a container with a mount whose source path contains an equals sign:
container run --rm --mount type=virtiofs,source=/tmp/a=b,destination=/mnt alpine true
The command fails with:
invalid directive format missing value source=/tmp/a=b in type=virtiofs,source=/tmp/a=b,destination=/mnt
Creating the directory first makes no difference, because the failure happens while parsing the flag.
Problem description
Parser.mount splits each comma-separated directive on = with maxSplits: 2:
In Swift, maxSplits counts splits rather than resulting elements, so a value that itself contains = produces three components:
"source=/tmp/a=b".split(separator: "=", maxSplits: 2)
// ["source", "/tmp/a", "b"]
The code then requires exactly two components and throws otherwise:
if keyVal.count != 2 {
throw ContainerizationError(.invalidArgument, message: "invalid directive format missing value \(part) in \(mount)")
}
A directive should split on the first = only, so that everything after it is the value. maxSplits: 1 produces ["source", "/tmp/a=b"].
Equals signs are legal in POSIX path names, so any bind mount whose source or destination contains one is currently unusable.
This is the same defect that #1978 and #1999 fix for Parser.labels. Neither touches Parser.mount, so mounts remain affected.
Environment
- OS: macOS 26.5.2 (25F84)
- Xcode: 26.6 (17F113)
- Container: main at 07ff3c0 (also present in 1.1.0)
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- Swift
- Stars
- 50.1k
- Forks
- 1.8k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apple/container
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla-mobile/firefox-ios#35743 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
manaflow-ai/cmux#13417 ·