Bug 2923

Summary: busybox ls -F <symbolic-link-file> does not print '@' symbol.
Product: Busybox Reporter: Yunho Kim <kimyunho>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: major CC: busybox-cvs
Priority: P5    
Version: 1.17.x   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description Yunho Kim 2010-12-10 04:18:53 UTC
We found the following bug by applying Concolic testing technique
to busybox ls.  Please see the following bug symptom compared to
linux ls utility.

--------------------------------------------
jiny@ubuntu:~/bugs$ ls -al
drwxr-xr-x  2 jiny jiny 4096 2010-12-17 06:55 .
drwxr-xr-x 47 jiny jiny 4096 2010-12-17 06:55 ..
-rw-r--r--  1 jiny jiny    0 2010-12-17 06:55 t
lrwxrwxrwx  1 jiny jiny    1 2010-12-17 06:55 t.lnk -> t

/*** BUG SYMPTOM ***/
jiny@ubuntu:~/bugs$ ls -F t.lnk
t.lnk@
jiny@ubuntu:~/bugs$ /mnt/hgfs/sharevm/busybox-1.17.4/busybox ls -F t.lnk
t.lnk  /* <--- NO @ SYMBOL PRINTED */

/*** W/O symbolic file name as a command line parameter,
busybox ls -F works fine ***/
jiny@ubuntu:~/bugs$ ls -F 
t  t.lnk@
jiny@ubuntu:~/bugs$ /mnt/hgfs/sharevm/busybox-1.17.4/busybox ls -F
t      t.lnk@
---------------------------------------------

We found that the third argument passed to my_stat at 1074 line of ls.c 
is the source of the problem. 

1074: cur = my_stat(*argv, *argv, !(all_fmt & (STYLE_LONG|LIST_BLOCKS)));
                                  -------------------------------------
The third argument becomes true when -F w/ no other options is given, 
which enforces my_stat() to invoke stat() (see line 298) instead of lstat().
Consequently, '@' is not printed out.
Comment 1 Denys Vlasenko 2010-12-19 05:17:28 UTC
Fixed in git:

http://git.busybox.net/busybox/commit/?id=163d86435729cc53d6d4088129f2cde106dd1318

Will be in 1.19.x