Bug 49

Summary: Busybox does not support "ls -Q" which is required by Debian init.d scripts
Product: Busybox Reporter: Andre Klapper <a9016009>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
URL: https://bugs.maemo.org/show_bug.cgi?id=3957
Host: Target:
Build:
Attachments: Patch to implement -Q and -g
adjust column width for multi-column ls -Q output

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?