Repository navigation
Stream file transfers on mounted paths through exec (#27) - #32
Merged
Merged
Conversation
apple/container's copy resolves paths against the container's rootfs from outside the container, beneath its mounts (apple/container#1873). Copying out of a mounted path fails with "path not found"; copying in reports success while the file lands in the rootfs under the mountpoint, where the container never sees it. In Davit that broke downloads from volumes and, worse, lost uploads silently, including every upload in the volume browser, whose helper container is deleted when the sheet closes. Paths on a mount now go through exec instead: downloads `cat` the file to a pipe drained into the host file (done at the pipe's EOF, not the exit), and uploads feed the host file to `cat` in chunks over a pipe. Everything else keeps using the platform's copy. Transfers run as root, like the copy does. The selftest round-trips a multi-chunk random file through a mounted volume, checks the container itself sees the upload, and checks a failed download leaves no partial file. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 of 3 tasks
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.
Fixes #27.
Problem
apple/container's copy resolves paths against the container's rootfs from outside the container, beneath its mounts (apple/container#1873, still open, reproduced on 1.5.0 upstream). Reproduced here on 1.3.1 with the plain CLI:
So in Davit:
/volumein a helper container. Every download from it fails. Every upload is lost when the sheet closes, because the helper is deleted.Fix
Paths under one of the container's mounts are streamed through exec instead. Everything else still uses the platform's copy.
cat < "$1"writes to a pipe that is drained into the host file. The download counts as done at the pipe's EOF, not at process exit, because the daemon can still be relaying output afterwait()returns. A failed download removes the partial file.cat > "$1"over a pipe in 1 MiB chunks. It isn't passed straight in as stdin because the daemon reads stdin withavailableData, which would pull a whole plain file into its memory at once. If the script fails, it still reads stdin to EOF, so the feed can't block on a full pipe.F_SETNOSIGPIPEturns a vanished reader into EPIPE instead of a SIGPIPE that would kill the app.Verification
wc -cvia exec, not just a listing), that the download matches byte for byte, and that a failed download leaves no partial file.selftestpasses against a live 1.3.1 platform.🤖 Generated with Claude Code