Skip to content

Refactor tmpfsMounts() to process tmpfs path correctly - #2103

Merged
katiewasnothere merged 7 commits into
apple:mainfrom
LevelVoid:fix-tmpfs
Aug 10, 2026
Merged

Refactor tmpfsMounts() to process tmpfs path correctly#2103
katiewasnothere merged 7 commits into
apple:mainfrom
LevelVoid:fix-tmpfs

Conversation

@LevelVoid

@LevelVoid LevelVoid commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Type of Change

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

Motivation and Context

Fixes #2094 : tmpfs works as stated in issue with tests added

Testing

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

@jglogan jglogan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LevelVoid Don't forget the absolute path test, see comment.

Also, you'll need to configure your account for verified commit signatures or we can't merge, see: https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#about-commit-signature-verification.

Thank you!

throw ContainerizationError(.invalidArgument, message: "mount destination cannot be empty")
}

let normalizedDest = FilePath(destination).lexicallyNormalized().string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compute the filepath first and guard to ensure that isAbsolute is true.
Then do the normalization and continue.

Add a test to ensure non-absolute destinations fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compute the filepath first and guard to ensure that isAbsolute is true. Then do the normalization and continue.

Add a test to ensure non-absolute destinations fail.

Got it, i will do that and push after configuring my account.

@jglogan

jglogan commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@LevelVoid Still seeing some formatting issues:

❌ The following files require formatting or license header updates:
Tests/ContainerAPIClientTests/ParserTest.swift

@LevelVoid

LevelVoid commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@LevelVoid Still seeing some formatting issues:

❌ The following files require formatting or license header updates:
Tests/ContainerAPIClientTests/ParserTest.swift

@jglogan I fixed the issues causing failure, and it's ready to review.

Comment thread Tests/ContainerAPIClientTests/ParserTest.swift Outdated
Comment thread Tests/ContainerAPIClientTests/ParserTest.swift Outdated

@jglogan jglogan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swift format is quite particular, two spaces

@jglogan

jglogan commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@LevelVoid I touched up the formatting. That means I'll need to have someone else approve the PR tomorrow to get it merged, but everything looks good to go. Thank you for fixing this!

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 24.36%
Integration 66.84%
Combined 76.27%

@LevelVoid

Copy link
Copy Markdown
Contributor Author

Thanks! Appreciate you taking the time to review it.

@katiewasnothere
katiewasnothere merged commit f13b723 into apple:main Aug 10, 2026
3 checks passed
henrywang added a commit to henrywang/Berthly that referenced this pull request Sep 2, 2026
Part of #130.

## What

apple/container 1.3.0
([apple/container#2103](apple/container#2103))
rewrote `Parser.tmpfsMounts` to split a `dest:opts` tmpfs entry into a
clean
destination + options list. Before the fix the entire `/scratch:rw`
string
became the mount destination.

That parser is client-side code Berthly links and calls in-process via
`Utility.containerConfigFromFlags`, so the pin bump in #133 already
picks up the
fix. The Run sheet passes tmpfs entries **verbatim** (`strings(from:)`
only
trims whitespace) — no app-code change needed. This PR adds the E2E
proof:

- **`testRunOptionsReachDaemon`** — tmpfs input changed to
`/scratch:rw`;
  asserts no mount destination in `container inspect` carries a colon.
- **`testRunOptionsTakeEffectViaExec`** — enters `/scratch:rw`, and
since that
  journey already boots with a **read-only root**, execs in to assert
  `/proc/mounts` shows `tmpfs` mounted at the clean `/scratch` and
  `touch /scratch/ok` succeeds (a real, writable, independent mount).

## Test plan

- [x] `xcodebuild build-for-testing` (all targets) — succeeds
- [x] `swiftlint lint --strict` — 0 violations
- [ ] **`scripts/e2e.sh
RunContainerJourneyTests/testRunOptionsTakeEffectViaExec`
— NOT completed.** Pulling
`ghcr.io/apple/containerization/vminit:0.41.0`
(needed to boot any 1.3.0 container) fails reproducibly on the test
machine's
network with `StreamClosed … HTTP2ErrorCode ProtocolError` at ~20 MB of
66 MB,
three attempts, same byte offset each time. The first E2E run got as far
as
filling the sheet and submitting; it only failed waiting for the VM to
boot.
Needs a run on a network with a clean path to ghcr.io before #130 closes
—
  keeping #130 open for that.
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]: --tmpfs option for container {create|run} does not split mount options.

3 participants