Skip to content

Conversation

@Yykz
Copy link
Contributor

@Yykz Yykz commented Dec 19, 2023

This PR addresses an issue where the method fails to consider spaces, backslashes, and tabs in a mount_dir field, as they are replaced by \040, \134, \011, respectively.
This issue was observed for both /etc/mtab and /proc/self/mountinfo.
Additionally, it introduces a new test to verify this correction.

It addresses #5678

$ ./target/release/coreutils df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sda3      233379840  49180744 181577576  22% /
devtmpfs            4096         0      4096   0% /dev
tmpfs            8166380     16356   8150024   1% /dev/shm
tmpfs            3266556      1820   3264736   1% /run
tmpfs            8166384     15144   8151240   1% /tmp
/dev/sda3      233379840  49180744 181577576  22% /home
/dev/sda2         996780    333408    594560  36% /boot
tmpfs            1633276       156   1633120   1% /run/user/1000
/dev/loop0         90333        46     83119   1% /mnt/f\oo

@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/timeout/timeout is no longer failing!

@tertsdiepraam
Copy link
Member

tertsdiepraam commented Dec 19, 2023

Cool! Do you know whether these are the only characters that are escaped? And should we be unescaping the other strings as well?

@Yykz
Copy link
Contributor Author

Yykz commented Dec 19, 2023

Cool! Do you know whether these are the only characters that are escaped? And should we be unescaping the other strings as well?

I noticed first about space by using df, then I find on linux manual page that just mentioning space and tabs but it was quite logic that backslash cannot be both part of the replacement and not be replaced.
I tested a bunch of special chars and couldn't find any others so I concluded that the replacement was just there so as not to confuse the fields.
For the other fields that may also happens if they can contains spaces/tabs but I don't know if it's possible

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/inotify-dir-recreate
Congrats! The gnu test tests/timeout/timeout is no longer failing!

@cakebaker cakebaker linked an issue Dec 20, 2023 that may be closed by this pull request
@sylvestre
Copy link
Contributor

needs rebasing :)

@Yykz Yykz closed this Dec 30, 2023
@Yykz Yykz deleted the df_mountinfo_dir branch December 30, 2023 21:01
@Yykz Yykz restored the df_mountinfo_dir branch December 30, 2023 21:05
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: file system not displayed when mount dir contains some chars

3 participants