-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: set default quoting style to literal when not TTY #5553
Conversation
I have no Windows machine on which I can test the actual output of Can someone verify the GNU ls behavior on Windows ? |
After finishing my work today, I'll test this |
@allaboutevemirolive Any update ? 😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I think this is good enough to be merged, apart from the tests. I think we can assume that Windows will work the same way, so if you can adapt the tests on Windows accordingly (see the CI output) then it should be fine!
If you want a next challenge (for another PR). Here's what the GNU docs say:
You can specify the default value of the --quoting-style option with the environment variable QUOTING_STYLE. If that environment variable is not set, the default value is ‘shell-escape’ when the output is a terminal, and ‘literal’ otherwise.
We don't support that environment variable yet either :)
GNU testsuite comparison:
|
I've updated the windows tests !
May I have the link to this ? |
Thanks for your PR :) |
This PR fixes the quoting behavior of
ls
when stdout is non-TTY.Until now, Coreutils'
ls
used the same default quoting style no matter what. However, GNUls
uses shell escaped quoting when stdout is a TTY, and Literal quoting otherwise.I had to modify some quoting tests which expected the TTY-flavored output.
In the future, we should test that the output is still correct when running in the terminal by emulating an stdout file descriptor that can fake the
is_terminal()
behavior.Fixes #5490