Fix handling of read-only source file cloning#139
Merged
JAORMX merged 2 commits intostacklok:mainfrom Apr 28, 2026
Merged
Conversation
Otherwise instead of reporting the actual I/O error the following error message will be shown: Error: creating workspace snapshot: walking workspace: context canceled
When a source file has exclusively read permissions (0444), writing to the file will fail. Instead open the destination file with write permissions and change them to match src after successful copy.
JAORMX
approved these changes
Apr 28, 2026
Contributor
JAORMX
left a comment
There was a problem hiding this comment.
Thanks for the fix! Confirmed the bug reproduces (FICLONE creates dst at the source's 0o400 mode, fails on tmpfs, and the copyFile fallback can't reopen the read-only dst — EACCES gets masked as "context canceled" via errgroup propagation). The reorder makes the underlying error visible, and opening at 0o600 + post-Chmod is the right fix. macOS path is unaffected (unix.Clonefile preserves perms in-kernel). LGTM.
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.
When invoking
bboxin a working directory with read-only file(s), the operation will fail with a "context canceled" error message. These changes fix handling of such files by opening the destination file with write permissions and changing them to match the source file permissions after a successful copy operation.Additionally, swap the error evaluation order in
CreateSnapshotin order to show underlying I/O error messages.