fix(runtime): propagate unexpected errno from realpathSync - #1908
Open
wasaybuilds wants to merge 1 commit into
Open
fix(runtime): propagate unexpected errno from realpathSync#1908wasaybuilds wants to merge 1 commit into
wasaybuilds wants to merge 1 commit into
Conversation
The segment-resolution loop handled ELOOP, ENOENT and ENOTDIR and broke out of the loop on every other errno, returning the partially resolved prefix as if it were the resolved path. A caller hitting EACCES on a path component got the parent directory back instead of an error. Unexpected errnos now go through throwNormalizedFsBridgeError so the guest sees the real failure, and the ENOENT branch uses createFsError so it carries errno like every other fs error from this bridge.
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.
Closes #1838.
realpathSyncsegment loop special-casedELOOP/ENOENT/ENOTDIRandbreak-ed on every other errno, then returned the partially resolved prefix as if it were the resolved path. Callers got a valid-looking wrong path — typically the parent directory — instead of the failure.throwNormalizedFsBridgeError, soEACCESand friends reach the guest with the right code,errno,syscallandpath.ENOENTbranch now usescreateFsErrorinstead of hand-rolling the error, which also gives it theerrnofield it was missing.Verified against the real resolution loop with the host
lstatstubbed, before and after:The third line is the reported symptom: a directory path returned where a file was requested, which is what surfaced as
EISDIRin the Claude CLI.I did not add a committed regression test — the only home I found for guest
fssemantics is a VM-level suite I can't run locally (no Rust toolchain on this machine). Happy to add one if you point me at the harness you'd want it in.