[PATCH] ls: fix support for long options when FEATURE_LS_COLOR is deselected

Laurent Bercot ska-dietlibc at skarnet.org
Fri May 26 13:52:20 UTC 2017


  (replying to myself because for some reason the busybox ML manager
does not send me the mails in a whole thread if I've been Cc:ed in
one of the messages in the thread. So now I need the Cc: every time.
ISTR it's a classic misfeature of Mailman.)

  Xabier Oneca:
 > Shouldn't "--color" be guarded by IF_FEATURE_LS_COLOR, then?

  As I understand it, it's a choice: if a feature is not selected
at build time, guarding the option declaration in applet_long_options
makes busybox fail when the option is given at run-time, whereas not
guarding it (i.e. always declaring the option) makes busybox silently
ignore it. Both approaches are justifiable.

  Since neither --full-time nor --group-directories-first appeared
to be guarded (by FEATURE_LS_TIMESTAMPS and FEATURE_LS_SORTFILES
respectively), I chose to stay as close as possible to the existing
code and not guard --color either.

  The syntax of getopt32() is not exactly intuitive to say the least.
I wonder what benefit it brings over getopt() and getopt_long(). Denys,
any insights?

--
  Laurent



More information about the busybox mailing list