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

ls: unquoted names should be indented with a space if there is a quoted name #5632

Closed
cakebaker opened this issue Dec 10, 2023 · 2 comments · Fixed by #5740
Closed

ls: unquoted names should be indented with a space if there is a quoted name #5632

cakebaker opened this issue Dec 10, 2023 · 2 comments · Fixed by #5740
Labels

Comments

@cakebaker
Copy link
Contributor

GNU ls indents unquoted names with a space if there is a quoted name:

$ touch a 'sp ace'
$ ls a 'sp ace' 
 a  'sp ace'
$ ls -l a 'sp ace' 
-rw-r--r-- 1 dho dho 0 Dec 10 16:38  a
-rw-r--r-- 1 dho dho 0 Dec 10 16:38 'sp ace'

uutils ls doesn't do such an indentation:

$ touch a 'sp ace'
$ cargo run ls a 'sp ace' 
a  'sp ace'
$ cargo run ls -l a 'sp ace' 
-rw-r--r-- 1 dho dho 0 Dec 10 16:38 a
-rw-r--r-- 1 dho dho 0 Dec 10 16:38 'sp ace'
@allaboutevemirolive
Copy link
Contributor

allaboutevemirolive commented Dec 15, 2023

Quoting flag for shell also didn't work.

$ ./coreutils ls --quoting-style=literal a 'sp ace'
a  sp ace

$ ./coreutils ls --quoting-style=shell a 'sp ace'
a  'sp ace'
$ ls --quoting-style=literal a 'sp ace'
a  sp ace

$ ls --quoting-style=shell a 'sp ace'
 a  'sp ace'

@mtimaN
Copy link
Contributor

mtimaN commented Dec 28, 2023

I wrote some code which patches this inconsistency but I am unsure how to write unit tests for it considering that ls formats differently if the output is directed to stdout.

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.

3 participants