[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    ls -d broken (should not follow symlink)
From:       Isaac Dunham <ibid.ag () gmail ! com>
Date:       2014-10-30 4:54:58
Message-ID: 20141030045457.GA15087 () newbook
[Download RAW message or body]

Hello,
I've run across a bug that occurs in both busybox and toybox versions of ls.
OS is Alpine Linux edge, which uses current musl and busybox 1.22.1.
git log indicates no relevant changes to busybox ls.
I'm using current toybox.

According to POSIX, "ls -d" means:
-d     Do not follow symbolic links named as operands unless the -H  or
       -L  options  are specified. Do not treat directories differently
       than other types of files.  The  use  of  -d  with  -R  produces
       unspecified results.

Simple testcase would be:
ln -s /dev/null/nothing nothing	#make broken symlink
ls -d nothing			#Which should say without error:

nothing

I was checking for missing symlinks to toybox in a small project; I have
toybox at bin/toybox, but not at /bin/toybox.
All symlinks point to /bin/toybox, however.

I tried to use this simple test to see if there were any links I 
needed to make:

$ for f in `bin/toybox`; do ls -d *bin/$f || echo MISSING $f; done

ls is currently busybox ls.

However, ls attempted to follow every link, showing all as missing.
Repeating this with toybox got similar results.

(Yes, I'm aware that I can use test -L/test -h instead. And it works.
But ls -d should not follow symlinks.)

Thanks,
Isaac Dunham

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic