Skip to content

Split mount directives on the first equals sign - #2016

Open
devops-thiago wants to merge 1 commit into
apple:mainfrom
devops-thiago:fix-mount-directive-equals
Open

devops-thiago wants to merge 1 commit into
apple:mainfrom
devops-thiago:fix-mount-directive-equals

Conversation

@devops-thiago

@devops-thiago devops-thiago commented Jul 25, 2026 •

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Fixes #2012.

Parser.mount splits each comma-separated directive with maxSplits: 2. In Swift that parameter counts splits rather than resulting elements, so a value that itself contains an equals sign produces three components:

"src=/tmp/a=b".split(separator: "=", maxSplits: 2)
// ["src", "/tmp/a", "b"]

The parser then requires exactly two components and throws invalid directive format missing value. Equals signs are legal in POSIX path names, so a bind mount whose source or destination contains one cannot be used today.

Splitting on the first equals sign keeps the remainder as the value. Directives that carry no value, such as readonly, still produce a single component and are unaffected.

#1978 and #1999 fix the same defect in Parser.labels. Neither changes Parser.mount.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

testMountBindSourceContainingEquals creates a directory whose name contains an equals sign and mounts it by absolute path. Against the current code the test fails with invalid directive format missing value; with this change it passes. The existing mount and publish-port tests continue to pass.

I also ran a debug build of this branch against a 1.5.0 daemon with the command from the issue. The 1.5.0 release and a build of main fail with invalid directive format missing value. This branch starts the container, and mount inside it shows virtiofs on /mnt type virtiofs (rw,relatime).

@devops-thiago
devops-thiago force-pushed the fix-mount-directive-equals branch from 49dfdd8 to 1c9c86b Compare August 7, 2026 19:16
@devops-thiago
devops-thiago force-pushed the fix-mount-directive-equals branch from 1c9c86b to 8b45175 Compare September 2, 2026 00:10
@devops-thiago
devops-thiago force-pushed the fix-mount-directive-equals branch from 8b45175 to f48ceec Compare September 6, 2026 15:40
@devops-thiago
devops-thiago force-pushed the fix-mount-directive-equals branch from f48ceec to 62e9214 Compare September 14, 2026 10:46
@devops-thiago
devops-thiago force-pushed the fix-mount-directive-equals branch from 62e9214 to 673eb30 Compare September 21, 2026 15:19
@devops-thiago
devops-thiago force-pushed the fix-mount-directive-equals branch from 673eb30 to 3262fae Compare September 29, 2026 13:41
Parser.mount split each comma-separated directive with maxSplits: 2, which
yields three components when the value itself contains an equals sign. The
parser then requires exactly two components, so any mount whose source or
destination path contains "=" failed with "invalid directive format missing
value". Equals signs are legal in POSIX path names.

Splitting on the first equals sign keeps the remainder as the value.

Fixes apple#2012
@devops-thiago
devops-thiago force-pushed the fix-mount-directive-equals branch from 3262fae to e255669 Compare October 1, 2026 16:26
@devops-thiago

Copy link
Copy Markdown
Author

Asking a few more people for review. I previously requested reviews from @egernst and @jglogan on #2019, but haven’t heard back, and CONTRIBUTING suggests trying someone else after a few weeks.

The only review so far is katiewasnothere’s on #2329 — thanks. I replied there.

I have 11 small PRs open. CI has not run on any of them because the workflows are still waiting for approval (action_required). Approving those runs would at least show whether they pass.

I tried to match each PR to areas you’ve worked on, but anyone is welcome to review any of them:

All commits are signed and the branches are rebased on main.

For each bug, I reproduced the issue on the 1.5.0 release and included the output in the PR. I also tested each fix from a build of its branch.

Those fixes started as fixes in the engine used by SiliconShip, a Mac app I build: https://apps.apple.com/app/id6797506428.

I’m happy to split, shrink, or close any of these if that would make review easier.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 25.35%
Integration 66.3%
Combined 75.8%

@devops-thiago

Copy link
Copy Markdown
Author

@dkovba thank you for approving the workflows. CI passes on this PR and it still merges cleanly into main. Is it good to merge as it is, or is there anything else you need from me?

@devops-thiago

Copy link
Copy Markdown
Author

@katiewasnothere this has been open since Jul 25 without a review. CI passes and it merges cleanly into main. Could you take a look when you have time, or tell me who else I should ask?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: --mount rejects a directive whose value contains "="

1 participant