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

df: fix output if input path is a file system #3435

Closed
wants to merge 1 commit into from

Conversation

cakebaker
Copy link
Contributor

@cakebaker cakebaker commented Apr 22, 2022

For example, df --out=source,target /dev/sda8 now shows:

Filesystem     Mounted on
/dev/sda8      /

instead of

Filesystem     Mounted on
dev            /dev

Fixes #3246.

@@ -68,7 +68,7 @@ where
path.as_ref().to_path_buf()
};
let matches = mounts.iter().filter(|mi| path.starts_with(&mi.mount_dir));
matches.max_by_key(|mi| mi.mount_dir.len())
matches.min_by_key(|mi| mi.mount_dir.len())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why this fixes the problem? I'm not able to figure it out. A comment would be very helpful. Also, the documentation for the function needs to be updated as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't explain it. I made a thinking error and concluded from the individual case that it will work in other cases too. Which is not the case. I tried it with another file system on my local system and it didn't work... So I guess my current approach to resolve this issue is flawed and I close this PR. Sorry for wasting your time.

@cakebaker cakebaker closed this Apr 23, 2022
@cakebaker cakebaker deleted the ticket_3246 branch April 26, 2022 12:18
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.

df: df doesn't check if the input path is a filesystem
2 participants