[BUG] 'ls -id' follows symbolic links

Martijn Dekker martijn at inlv.org
Wed Dec 19 20:30:34 UTC 2018


When listing a symbolic link, the busybox 'ls -id' command incorrectly 
lists the inode of the link referred to by the symlink, rather than the 
inode of the symlink itself. The -d option is supposed to disable 
dereferencing of symbolic links[*].

$ ln -s /bin/ls /tmp/foo
$ _install/bin/ls -id /tmp/foo /bin/ls
11539968 /bin/ls  11539968 /tmp/foo
(note identical inodes)

Note that 'ls -idl' does work correctly:
$ _install/bin/ls -idl /tmp/foo /bin/ls
11539968 -rwxr-xr-x    1 root     root        113176 Jan 17  2012 /bin/ls
11546705 lrwxrwxrwx    1 martijn  adm              7 Dec 19 21:27 
/tmp/foo -> /bin/ls
(note different inodes)

Thanks,

- M.

[*] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html


More information about the busybox mailing list