[Toybox] [PATCH][TEST] ls -d should not follow symlink

Isaac Dunham ibid.ag at gmail.com
Thu Oct 30 09:11:01 PDT 2014


Test ls -d to make sure it does not follow links.

--
On Thu, Oct 30, 2014 at 05:37:35AM -0500, Rob Landley wrote:
> Got it.
> http://landley.net/hg/toybox/rev/1540
> Thanks,
> Rob

Also, looking at man 1p ls, it looks like -HL takes priority over -dFl.
(Yes, -F also implies not following links.)

Thanks,
Isaac Dunham
-------------- next part --------------
diff --git a/tests/ls.test b/tests/ls.test
index d052f13..9866eb7 100644
--- a/tests/ls.test
+++ b/tests/ls.test
@@ -37,6 +37,10 @@ testing "ls softlink - long listing" "$IN && ls -l slink | awk '{ print \$NF }'
           "file1.txt\n" "" ""
 rm -f lstest/slink
 
+ln -s /dev/null/nosuchfile lstest/nosuchfile
+testing "ls with -d - broken softlink" "$IN && ls -d nosuchfile; $OUT" "nosuchfile\n" "" ""
+rm -f lstest/nosuchfile
+
 rm -rf lstest/* && mkdir -p lstest/dir1 && touch lstest/file1.txt
 testing "ls nested recursively" "$IN && ls -R; $OUT" \
           ".:\ndir1\nfile1.txt\n\n./dir1:\n" "" ""


More information about the Toybox mailing list