4 ms·
They broke it in 2016. https://www.gnu.org/software/coreutils/quotes.html https://www.gnu.org/software/coreutils/quotes.html At least with Gnu, you can recomp
by _jal 7y ago
They broke it in 2016.
https://www.gnu.org/software/coreutils/quotes.html https://www.gnu.org/software/coreutils/quotes.html
At least with Gnu, you can recompile your own, non-broken version, which is the only saving grace of these stupid, trendy changes.
- Anthony-G 7y agoNot broken at all. I really don’t understand the hate for this change. I deal with a lot of filenames with spaces and think this change is a great improvement for listing such files. With this change it’s much easier to see where one filename ends and the other begins. Before this change, I had to use the `-1` option to ensure that each filename was listed on a line by itself. Now the filename listings are much more readable and it takes less cognitive effort to take it all in. The way it handles filenames with ASCII apostrophes/single quotes works particularly well (wraps the filename in double quotes instead of single quotes) and makes it very easy to copy and paste filenames to and from the terminal. Best of all, this change only applies when standard output is a TTY device so this does not break any shell scripts (even though parsing `ls` is a bad idea in any case) and is still compliant with the POSIX specification[1] which states that “If the output is to a terminal, the format is implementation-defined”. 1. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/l...
- deleted 7y ago[deleted]
- Delk 7y agoIt would seem that calling ls with the -N switch would disable the quoting. Might be easier to just have ls aliased to "ls -N" rather than recompiling. Unless the -N switch also does something else you don't like.
- arbitrage 7y agoagain, aliasing it is fine for interactive use. the point is that this breaks an unbelievable amount of already deployed scripts. The new functionality should be optional, and accessed via switches and aliases if you like it. this was very much a change only a few people liked, that they decided to force down literally everyone else's throats. it's very poor stewardship.
- Delk 7y agoOkay. The GNU page says the quoting is only done when the output is a terminal, so it shouldn't generally affect scripts. Although considering that the world of unix shells is fairly complex, I wouldn't be surprised if there was some kind of a weird but explainable situation where some kind of a script would still break, so I suppose it could be a problem somewhere.
- chubot 7y agoThe old behavior was the bad one; the new behavior is good. And that link explains why very well. I guess I should have figured that oblique references to "ls quoting fiasco" is shorthand for "I don't understand what's wrong but I'm angry about it..." (On the other hand I would say the grep -a issue is bad both before and after because either way it relies on autodetection. The fundamental issue there is that there is too much variance in encodings, which isn't easy to fix. Luckily UTF-8 is growing in popularity, and it doesn't have this issue because it doesn't require metadata for extremely common operations like "find ascii substring".)
- _jal 7y ago> but I'm angry about it. Take it to Reddit. I know perfectly well what's going on, and also know better then to discuss it with people who act like that.
- wruza 7y ago”The old behavior was the bad one; the new behavior is good” If you’re a human, yes. If you’re a script, it breaks you in half. If you’re a script that has to run on various versions, then maybe it’s time fix yourself and use find. You’re a sophisticated script after all, not one of these who require a human with a debugger. Modern culture may not appreciate that little ‘compat’ thing, but it is essential if you want something to continue to work and not just stop and wait for someone’s educated guesses. Good software doesn’t point fingers at you, it just works. I remember how recently I wanted to check network interfaces on some machine and commanded ‘ifconfig’. Now it’s called ‘ip a’, and there is no ifconfig. I can guess the reason – ifconfig was bad and ip is good. There is also an eternal “FAT” label issue in unetbootin app, which resurrects every time Apple changes its fdisk output format (in every release, as it seems). The workaround is to run it with a cli option – a very thing that unetbootin was created for to skip. This is what makes systems so much fun. Without all these cool things, we would just sit there and cry over our uselessness. ed: I read below that ls does that in interactive mode only, maybe it’s not that bad then.
- steerablesafe 7y agoHats off if your script used ls and handled weird characters in filenames just fine.