[Bug 2941] New: Busybox ls: no space between two columes in the output with -i option

bugzilla at busybox.net bugzilla at busybox.net
Sat Dec 11 09:22:57 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=2941

           Summary: Busybox ls: no space between two columes in the output
                    with -i option
           Product: Busybox
           Version: 1.17.x
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Standard Compliance
        AssignedTo: unassigned at busybox.net
        ReportedBy: kimyunho at kaist.ac.kr
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


Through applying concolic testing to busybox ls code, 
we found that busybox ls does not print space between two columns when
1. -i option is given 
2. an index number is more than 8 digits
3. a length of the full file name in the 1st column 
is no less than 2nd column's file name 
-------------------------------
// Linux ls output
$ ls -i ~yang/12345 ~yang/11111
154930324 /home/yang/11111  154930124 /home/yang/12345

// Busybox ls output
$ ./busybox ls -i ~yang/12345 ~yang/11111
154930324 /home/yang/11111154930124 /home/yang/12345  
// A user cannot distinquish a file name in the first column and 
// an index number of the second column, since
// no space is given between column 1 and column 2.
---------------------------------

The bug is in line 756 of ls.c (showfiles()) where ls assumes that an index
number for a file is only 8 digits.  Similar error can happen for files with
large block numbers that are longer than 5 digits (see line 757). 

754:    column_width += tabstops +
755:        IF_SELINUX( ((all_fmt & LIST_CONTEXT) ? 33 : 0) + )
756:        ((all_fmt & LIST_INO) ? 8 : 0) +   // maximum length is ONLY 8
757:        ((all_fmt & LIST_BLOCKS) ? 5 : 0); // maximum length is ONLY 5

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list