[Toybox] [PATCH] ls -N.

Rob Landley rob at landley.net
Fri Dec 2 00:30:44 PST 2022


On 12/1/22 15:05, Rob Landley wrote:
>>     --quote-name which is the new nonsense they added and made the default. They
>>     used up the -Q character for something else LONG AFTER adding
>>     --hide-control-chars without a corresponding short opt because gnu.
>> 
>> (as we determined years ago, "this is what happens when 'design' is done by
>> drive-by commits".)
> 
> Could be worse. Could be systemd.

Nope, -Q isn't the new dynamic quoting, -Q puts gratuitous "" around every
single entry. That said, -Q and -b switch each other off, and I have just found
a RENDERING BUG IN XFCE'S TERMINAL PROGRAM. The last blob of:

  T̹̳H̳e̪̭̝͙͕R̳̪͕̬̼̝͙Ȩ̮̖̤

Isn't entirely there (even in thunderbird the cursor refuses to go AFTER it),
and in xfce it just sort of progressively draws in as you type more characters
on the next line? (It's not there at all when you get the cursor prompt, then
it's a straight line after... the first time I backspace to DELETE text on the
newline. That changes what's rendered on the previous line. And after some more
more typing it fills out into a flattened heart-shaped blob. Why is what I'm
typing on THIS line changing what rendered on the PREVIOUS line? Is something
uninitialized here, or...?)

It's really creepy going "did this produce the same output" and watching the
output CHANGE AFTER THE FACT AS YOU TYPE MORE STUFF.

Right. ANYWAY, ls -Nb seems equivalent to ls -b, and ls -bN is ls -N, so that's
trailing [-bN] in the optstr, I haven't implemented -Q, and debian's -q doesn't
WORK anymore, ls -q is giving me

  'one'$'\t''two'

Yes with all those single quotes and the $. Whatever weird mode gnu/dammit added
is overriding -q, but:

  $ alias ls
  alias ls='ls --color=auto'

This behavior was not requested in alias.

I literally cannot regression test this. And THEY very clearly didn't.

Screw it, I'm changing the [!Nqb] to [-Nqb] and calling it good. And now I need
to splice my ls --sort work back in on top of this (of course the patch doesn't
apply)...

What the HECK is up with -c?

  ls      = alphabetical sort
  ls -t   = sort by mtime
  ls -c   = sort by ctime
  ls -l   = long output alphabetical sort
  ls -lt  = long output sort by mtime

Makes sense so far, right?

  ls -lc  = long output alphabetical sort show ctime instead of mtime
  ls -ltc = long output sort by ctime

I hate all things gnu. (I probably already got this right the first time around,
I need to go check I have tests for it all, but I'm REDOING this stuff to add
more --sort modes and because https://github.com/landley/toybox/pull/358 and it
is NOT CONSISTENT. Hard to write systematic code with jagged edge special cases
lurking there...)

Ahem. Gotta make it work. I really need to get mkroot providing a native
development environment I can build packages in so I can empirically demonstrate
what is and isn't actually being used out in the wild, or at least what I can
find examples of. (Speaking of, new kernel using --wildcards in tar, I haven't
forgotten. It's just gotten a bit pushed down the stack...)

Rob


More information about the Toybox mailing list