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: incorrect whitespace between columns in output table #3194

Closed
jfinkels opened this issue Feb 26, 2022 · 3 comments · Fixed by #3386
Closed

df: incorrect whitespace between columns in output table #3194

jfinkels opened this issue Feb 26, 2022 · 3 comments · Fixed by #3386
Labels

Comments

@jfinkels
Copy link
Collaborator

This whitespace between columns in the table produced by df does not match that of GNU df.

GNU df:

$ df | head -n4
Filesystem                1K-blocks     Used Available Use% Mounted on
udev                        3858016        0   3858016   0% /dev
tmpfs                        782624     2112    780512   1% /run
/dev/mapper/vgubuntu-root 242791844 94907344 135481608  42% /

uutils df:

$ ./target/debug/df | head -n4
Filesystem          1k-blocks         Used    Available  Use% Mounted on       
udev                  3858016            0      3858016    0% /dev            
tmpfs                  782624         2112       780512    0% /run            
/dev/mapper/vgubuntu-root    242791844     94907356    147884488   39% /  

It appears that the column width depends on the length of the largest entry in the column.

@crazystylus
Copy link
Contributor

Can you run this $ ./target/debug/df | head -n4 | bat -App and share the output, so that EOL and space characters are visible?

@jfinkels
Copy link
Collaborator Author

jfinkels commented Mar 2, 2022

What is bat -App? Maybe a Windows thing. Maybe this helps you see them:

$ ./target/debug/df | head -n 4 | tr " " _
Filesystem__________1k-blocks_________Used____Available__Use%_Mounted_on_______
udev__________________3858016____________0______3858016____0%_/dev____________
tmpfs__________________782624_________2116_______780508____0%_/run____________
/dev/mapper/vgubuntu-root____242791844_____81529496____161262348___34%_/_______________
$ df | head -n 4 | tr " " _
Filesystem________________1K-blocks_____Used_Available_Use%_Mounted_on
udev________________________3858016________0___3858016___0%_/dev
tmpfs________________________782624_____2116____780508___1%_/run
/dev/mapper/vgubuntu-root_242791844_81529496_148859456__36%_/

You can also see the whitespace characters if you just copy the output block in my comment above and paste it into your own text editor.

@crazystylus
Copy link
Contributor

What is bat -App? Maybe a Windows thing. Maybe this helps you see them:

$ ./target/debug/df | head -n 4 | tr " " _
Filesystem__________1k-blocks_________Used____Available__Use%_Mounted_on_______
udev__________________3858016____________0______3858016____0%_/dev____________
tmpfs__________________782624_________2116_______780508____0%_/run____________
/dev/mapper/vgubuntu-root____242791844_____81529496____161262348___34%_/_______________
$ df | head -n 4 | tr " " _
Filesystem________________1K-blocks_____Used_Available_Use%_Mounted_on
udev________________________3858016________0___3858016___0%_/dev
tmpfs________________________782624_____2116____780508___1%_/run
/dev/mapper/vgubuntu-root_242791844_81529496_148859456__36%_/

You can also see the whitespace characters if you just copy the output block in my comment above and paste it into your own text editor.

bat is cat's clone in Rust with wings, check this out https://github.com/sharkdp/bat. I will try to figure a way to pass column width without adding an entry at each row struct.

cakebaker added a commit to cakebaker/coreutils that referenced this issue Apr 11, 2022
cakebaker added a commit to cakebaker/coreutils that referenced this issue Apr 12, 2022
cakebaker added a commit to cakebaker/coreutils that referenced this issue Apr 12, 2022
cakebaker added a commit to cakebaker/coreutils that referenced this issue Apr 12, 2022
cakebaker added a commit to cakebaker/coreutils that referenced this issue Apr 13, 2022
sylvestre pushed a commit to cakebaker/coreutils that referenced this issue Apr 13, 2022
cakebaker added a commit to cakebaker/coreutils that referenced this issue Apr 13, 2022
cakebaker added a commit to cakebaker/coreutils that referenced this issue Apr 15, 2022
cakebaker added a commit to cakebaker/coreutils that referenced this issue Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants