fix: mkdir and rm report backend errors instead of crashing the exec#48
Merged
Conversation
Both commands matched only the error kinds the in-memory backend can produce (:eexist/:enoent for mkdir, :enoent/:enotempty for rm); a mount whose backend rejects the mutation with anything else — :enotsup from a git-tree-backed workspace, :erofs from a read-only archive — crashed the whole exec with a CaseClauseError. Any other backend error now reports through FS.strerror/1 with exit code 1, matching how ln already degrades on backends without symlink support. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FpxHS5iGm9ktgpnL9QZu9x
ivarvong
force-pushed
the
fix/mkdir-backend-errors
branch
from
July 2, 2026 20:57
59a050c to
f2080cd
Compare
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.
Running
mkdirorrmon a mount whose backend rejects the mutation crashed the entireJustBash.exec/2with aCaseClauseErrorinstead of failing the command:Both commands matched only the error kinds the in-memory backend can produce (
:eexist/:enoentfor mkdir,:enoent/:enotemptyfor rm). Any other backend error —:enotsupfrom a git-tree-backed workspace,:erofsfrom a read-only archive — now reports throughFS.strerror/1with exit code 1, matching howlnalready degrades on backends without symlink support.Adds a
NoEmptyDirsBackendfixture intest/support: a writable backend that rejects directory creation (the shape of any git-tree-backed mount), with aread_onlymode for:erofspaths. The other mutation commands (cp,mv,tee,touch,ln,chmod,chown) already have catch-all error clauses.🤖 Generated with Claude Code
https://claude.ai/code/session_01FpxHS5iGm9ktgpnL9QZu9x