A mount point's ancestors were unreachable whenever / was mounted - #435
Merged
Conversation
…nted
`readlink -f` failing on a rooted mount was one caller meeting a router bug.
`ls`, `stat`, `cd` and the file tests fail the same way, on the same paths:
ls /…/project -> not found
[[ -d /…/project ]] -> false
where `/…/project/fixture` is a mount and something else covers `/`.
The router already knew the answer. `stat`, `lstat`, `list` and `path_access`
each carry an ancestor branch that synthesizes a directory for a path above a
mount, because a mount at `/a/b/c` implies `/a/b` is a directory the same way
a real mount implies its mount point's parents exist.
That branch sat on the `Err` arm of `find_mount`. Mounting `/` makes
`mount_of` match every path, so `find_mount` always succeeds, the backend
covering `/` is asked for `/a`, and its `NotFound` returns to the caller
before the ancestor branch can run. The code was correct and unreachable in
the one configuration every embedder uses -- a root mount plus a deeper one.
The check now runs on the answer rather than on the routing. Only `NotFound`
is recovered: any other error is the backend's answer about a path it owns
and reaches the caller unchanged, so this cannot mask a permission failure.
This supersedes the ancestor half of readlink's own fix. Against this commit
alone, 7 of that branch's 8 tests pass with none of its `is_structural` /
`owning_mount` code present; the 8th is containment, which is a separate
guarantee and stays there.
A control pins the boundary: a path that is not an ancestor of any mount is
still absent, so synthesizing ancestors did not make the namespace exist.
tobert
force-pushed
the
fix/router-synthesizes-mount-ancestors
branch
from
September 2, 2026 12:38
281220f to
8c1f7a0
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.
readlink -ffailing on a rooted mount was one caller meeting a router bug.ls,stat,cd, and the file tests fail the same way on the same paths:where
/…/project/fixtureis a mount and another backend covers/.The router already knew the answer.
stat,lstat,list, andpath_accesseach carry a branch that synthesizes a directory for a path above a mount, because a mount at/a/b/cimplies/a/bis a directory the same way a real mount implies its mount point's parents exist.That branch sat on the
Errarm offind_mount. Mounting/makesmount_ofmatch every path, sofind_mountalways succeeds, the backend covering/is asked for/a, and itsNotFoundreaches the caller before the ancestor branch can run. The code was correct and unreachable in the one configuration every embedder uses — a root mount plus a deeper one.The check now runs on the answer rather than on the routing. Only
NotFoundis recovered: any other error is the backend's answer about a path it owns and reaches the caller unchanged, so this cannot mask a permission failure.A control pins the boundary — a path that is not an ancestor of any mount is still absent, so synthesizing ancestors did not make the namespace exist.
Gates:
clippy -D warnings,cargo test --all(6519 passed, 0 failed),insta --check, rustdoc-D warnings.