[Toybox] Stupid ls API question.

Rob Landley rob at landley.net
Thu May 4 01:41:41 PDT 2023


So in ls I have [-Nbq] where -q would print ? instead of nongraphic characters,
-b would do c-style escapes for nongraphic characters, and -N would pass them
through literally. Simple, right?

But that's not what the gnu/dammit version does. -b and -q replace each other,
and -N turns off -b. But -N does NOT turn off -q, only -b. Instead they added a
the magic longopt --show-control-chars that does what you'd THINK -N does.

This means touch $'hello \rworld'; ls -qN prints hello ?world with gnu/dammit
ls, which is sad.

Oh, and for extra fun, "man ls" doesn't mention it in my distro but ls has
changed its default output style AGAIN to do --quoting-style=shell-escape by
default when output is to a terminal, which A) does not seem to have a short
option at all, B) is implemented in a PROFOUNDLY stupid manner.

1) The above comes out as 'hello '$'\r''world' which changes quote contexts
THREE TIMES for no obvious reason, and even the somewhat awkward touch
abc\'$'\r'def becomes the amazingly awkward 'abc'\'''$'\r''def

2) Ever filename that is NOT escaped winds up indented by one space, which is
how I first noticed the Fresh Gnu Stupid.

Anyway: I'm leaning towards leaving toybox -N doing what it's doing because
random gnu thrashing du jour is just deeply sad, but I wanted to ping the list
to see if anybody had strong opinions?

Rob


More information about the Toybox mailing list