I have done the following
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:
https://github.com/apple/container/blob/main/Sources/Services/ContainerAPIService/Client/Parser.swift#L371
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 have done the following
Steps to reproduce
Run a container with a mount whose source path contains an equals sign:
The command fails with:
Creating the directory first makes no difference, because the failure happens while parsing the flag.
Problem description
Parser.mountsplits each comma-separated directive on=withmaxSplits: 2:https://github.com/apple/container/blob/main/Sources/Services/ContainerAPIService/Client/Parser.swift#L371
In Swift,
maxSplitscounts splits rather than resulting elements, so a value that itself contains=produces three components:The code then requires exactly two components and throws otherwise:
A directive should split on the first
=only, so that everything after it is the value.maxSplits: 1produces["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 touchesParser.mount, so mounts remain affected.Environment
Code of Conduct