Skip to content

mountpoint: check the target path parent#547

Open
favilances wants to merge 1 commit intouutils:mainfrom
favilances:mountpoint-parent-check
Open

mountpoint: check the target path parent#547
favilances wants to merge 1 commit intouutils:mainfrom
favilances:mountpoint-parent-check

Conversation

@favilances
Copy link
Copy Markdown

Summary

Fixes mountpoint so it compares the target path with the target path's parent instead of the process working directory's parent.

Motivation

The previous check could report regular directories such as /etc as mount points when the current working directory lived on a different filesystem. util-linux reports non-mountpoints with exit status 32, so this also returns that status for non-mountpoint paths.

Fixes #366.

Testing

  • cargo test test_mountpoint --features mountpoint
  • cargo clippy --all-targets --features mountpoint
  • cargo fmt --check
  • cargo test

Note: cargo clippy --all-targets --all-features still fails on current main because uudoc is missing direct dependency declarations for zip and uuhelp_parser; that is handled separately in #546.

mountpoint determines whether a path is a mount point by comparing it with its parent. The implementation was checking the process working directory's parent instead, which could make regular directories look like mount points.

Use the target path parent for the comparison and return util-linux's non-mountpoint exit status so this behavior is covered by a focused regression test.

Signed-off-by: favilances <favilances@proton.me>
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 this pull request may close these issues.

Mountpoint reports non-mount point directories like /etc as mount points while it shouldn't

1 participant