[Toybox] new coreutils ls quoting options...

enh enh at google.com
Thu May 3 15:37:00 PDT 2018


On Thu, May 3, 2018 at 2:31 PM, Rob Landley <rob at landley.net> wrote:
>
> On 05/03/2018 12:55 AM, enh wrote:
> > i was surprised to see all the files in `ls` output indented by one
> > space today. turns out that was because there was a file with a space
> > in the name in that directory.
>
> I worked out that the reason ls had two spaces between columns is if an entry
> ends with a utf8 combining char it eats a trailing space to put an umlaut over
> it or similar. So I should probably go back to minimum 2 spaces between columns.
> (It's on the todo list.)
>
> > /tmp/x$ touch 'hello.txt' 'hello world.txt'
> > /tmp/x$ ls
> >  hello.txt  'hello world.txt'
> > /tmp/x$ ls -1
> > hello.txt
> > 'hello world.txt'
>
> Huh. That's going to break a lot of scripts.
>
>   $ while read a; do echo "$a"; break; done
>   'one two'
>   'one two'
>
> Lovely.
>
> > /tmp/x$ ls --quoting-style=
> > ls: ambiguous argument ‘’ for ‘--quoting-style’
> > Valid arguments are:
> >   - ‘literal’
> >   - ‘shell’
> >   - ‘shell-always’
> >   - ‘shell-escape’
> >   - ‘shell-escape-always’
> >   - ‘c’
> >   - ‘c-maybe’
> >   - ‘escape’
> >   - ‘locale’
> >   - ‘clocale’
> > Try 'ls --help' for more information.
> > /tmp/x$ ls --quoting-style=literal
> > hello.txt  hello world.txt
> > /tmp/x$ ls --quoting-style=shell
> >  hello.txt  'hello world.txt'
> > /tmp/x$ ls --quoting-style=c
> > "hello.txt"  "hello world.txt"
> >
> > i'm not sure what the default corresponds to. presumably "shell",
> > which ought to have been "shell-maybe" to match "c-maybe"? (or "c"
> > should have been "c-always" and "c-maybe" should have been "c"?
> > another defeat snatched from the jaws of victory by the FSF... i
> > wonder when they'll add the option so i can get shell and c quoting
> > for the help text, rather than these left/right quotes?)
>
> Are you proposing implementing this... change?

no. i only noticed it last night. (and then again today, so i guess i
literally only just got this update. many of my most-frequented
directories have strangely-named files in them, as i suspect is true
for you.) a quick poll suggests i'm the only one who's noticed so far.

i suspect one (or more) of these might actually be useful. because
certainly the existing set of options are pretty terrible. but time
will tell. i just thought you'd be interested since i know we've both
complained about the existing options before.

> I haven't updated my ubuntu past 14.04 because it's the last LTS that didn't
> have systemd in it, and I'm vaguely trying to get an android native development
> environment working before that goes out of support. (Or else I'll have to move
> to devuan or something...) So I haven't seen the recent stuff the FSF is doing
> with itself.

fwiw, Google's moved off ubuntu. our desktops are using debian testing
these days. (see
https://www.zdnet.com/article/google-moves-to-debian-for-in-house-linux-desktop/
for example.)

> I'm not tied to the current behavior (other than 30 years of inertia having a
> certain amount of pull), but I'd object to implementing 37 selectable duplicate
> codepaths most of which will never get significant regression testing, and I'd
> prefer any new behavior make _sense_ rather than blindly copying whatever the
> FSF's doing.
>
> So if our behavior should change, what should it change _to_?
>
> Rob
>
> P.S. https://www.patreon.com/posts/job-change-and-18518050 in case you were
> wondering what I've been up to.



More information about the Toybox mailing list