Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file_path_by_searching does not work across mountpoint boundaries #330

Closed
asomers opened this issue Sep 18, 2023 · 0 comments · Fixed by #333
Closed

file_path_by_searching does not work across mountpoint boundaries #330

asomers opened this issue Sep 18, 2023 · 0 comments · Fixed by #333

Comments

@asomers
Copy link
Contributor

asomers commented Sep 18, 2023

file_path_by_searching tries to identify a directory's pathname by iterating through its parent's children and matching the dev and ino fields. The problem is that if the directory in question is a file system root, then its ino won't match. Readdir will show the ino of the underlying mountpoint, whereas the directory's own ino method will show the ino of its root directory.

Steps to Reproduce

On a non-Linux, non-Darwin system (tested on FreeBSD 15.0-CURRENT), set TMPDIR to a file system's mountpoint. This is the default on a ZFS-root system, where /tmp is a separate ZFS file system.

cd cap-primitives
cargo test --lib fs::dir_paths
asomers added a commit to asomers/cap-std that referenced this issue Sep 18, 2023
If a direntry comes from a mountpoint's parent, then its ino will be the
ino of the underlying directory, not the mounted file system's root
directory.  So ignore the direntry's ino, and just look at the ino in
its metadata.

Fixes bytecodealliance#330
sunfishcode pushed a commit that referenced this issue Oct 11, 2023
If a direntry comes from a mountpoint's parent, then its ino will be the
ino of the underlying directory, not the mounted file system's root
directory.  So ignore the direntry's ino, and just look at the ino in
its metadata.

Fixes #330
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant