Bug 49 - Busybox does not support "ls -Q" which is required by Debian init.d scripts
Summary: Busybox does not support "ls -Q" which is required by Debian init.d scripts
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: unspecified
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL: https://bugs.maemo.org/show_bug.cgi?i...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-15 11:19 UTC by Andre Klapper
Modified: 2010-03-21 18:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
Patch to implement -Q and -g (8.64 KB, patch)
2009-03-03 14:08 UTC, Denys Vlasenko
Details
adjust column width for multi-column ls -Q output (528 bytes, patch)
2010-03-21 13:54 UTC, Lucas Maneos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Klapper 2009-01-15 11:19:32 UTC
Forwarding upstream from https://bugs.maemo.org/show_bug.cgi?id=3957 .

VERSION:
1.10.3

STEPS TO REPRODUCE:
In Busybox, enter
  ls -Q

EXPECTED OUTCOME:
quoted list of files. 
GNU "ls -Q" encloses filenames in double quotes.

ACTUAL OUTCOME:
  ls: invalid option -- Q
and the list of valid options

REPRODUCIBILITY:
always

OTHER COMMENTS:
-Q is not a posix standard option, but is quite popular and useful.
Many debian pre/post inst/rm scripts use this for things in /etc/init.d.

Other examples where this is an issue:
https://bugs.maemo.org/show_bug.cgi?id=3951#c6
https://bugs.maemo.org/show_bug.cgi?id=3948#c2
Comment 1 Denys Vlasenko 2009-03-03 14:08:15 UTC
Created attachment 87 [details]
Patch to implement -Q and -g
Comment 2 Denys Vlasenko 2009-03-03 14:09:35 UTC
Fixed in revision 25505, thanks!
Comment 3 Lucas Maneos 2010-03-21 13:54:04 UTC
Created attachment 1345 [details]
adjust column width for multi-column ls -Q output

A minor (I assume most consumers of ls -Q would be running it in single-column mode) issue is that in multi-column mode the column width isn't adjusted to include the quotes.  The attached patch is against 1.16.0.
Comment 4 Denys Vlasenko 2010-03-21 18:07:17 UTC
I don't see why it is needed. Without patch it already looks correct:

# ./busybox ls
AUTHORS                 busybox_ldscript        libbb
Config.in               busybox_ldscript_nobss  libpwdgrp
...
busybox                 init                    util-linux
# ./busybox ls -Q
"AUTHORS"                 "busybox_ldscript"        "libbb"
"Config.in"               "busybox_ldscript_nobss"  "libpwdgrp"
...

With -Q, columns become 2 chars wider. Right?