ls: set default quoting style to literal when not TTY#5553
ls: set default quoting style to literal when not TTY#5553cakebaker merged 5 commits intouutils:mainfrom
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.
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
lswhen stdout is non-TTY.Until now, Coreutils'
lsused the same default quoting style no matter what. However, GNUlsuses 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