diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-03-12 03:12:36 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-03-12 03:12:36 +0100 |
commit | ea684c6aaf23ead57fac74c3ceaa651c1ae625ec (patch) | |
tree | da6e00ce493280918139e6d4ae504be23ad8af8c | |
parent | 8345b2bd5ea28bd8d07886e615b9c2d5ab35477d (diff) | |
download | busybox-w32-ea684c6aaf23ead57fac74c3ceaa651c1ae625ec.tar.gz busybox-w32-ea684c6aaf23ead57fac74c3ceaa651c1ae625ec.tar.bz2 busybox-w32-ea684c6aaf23ead57fac74c3ceaa651c1ae625ec.zip |
ls: fix handling of symlinks by option -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/ls.c | 6 | ||||
-rwxr-xr-x | testsuite/ls.tests | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 19c868ca4..847fdec07 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -1,6 +1,5 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * tiny-ls.c version 0.1.0: A minimalist 'ls' | ||
4 | * Copyright (C) 1996 Brian Candler <B.Candler@pobox.com> | 3 | * Copyright (C) 1996 Brian Candler <B.Candler@pobox.com> |
5 | * | 4 | * |
6 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 5 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
@@ -1145,7 +1144,10 @@ int ls_main(int argc UNUSED_PARAM, char **argv) | |||
1145 | do { | 1144 | do { |
1146 | cur = my_stat(*argv, *argv, | 1145 | cur = my_stat(*argv, *argv, |
1147 | /* follow links on command line unless -l, -s or -F: */ | 1146 | /* follow links on command line unless -l, -s or -F: */ |
1148 | !((all_fmt & (STYLE_LONG|LIST_BLOCKS)) || (option_mask32 & OPT_F)) | 1147 | !((all_fmt & STYLE_MASK) == STYLE_LONG |
1148 | || (all_fmt & LIST_BLOCKS) | ||
1149 | || (option_mask32 & OPT_F) | ||
1150 | ) | ||
1149 | /* ... or if -H: */ | 1151 | /* ... or if -H: */ |
1150 | || (option_mask32 & OPT_H) | 1152 | || (option_mask32 & OPT_H) |
1151 | ); | 1153 | ); |
diff --git a/testsuite/ls.tests b/testsuite/ls.tests index 1669579e7..e2284658d 100755 --- a/testsuite/ls.tests +++ b/testsuite/ls.tests | |||
@@ -251,6 +251,16 @@ test x"$CONFIG_UNICODE_SUPPORT" = x"y" \ | |||
251 | 0110_5.3.2__U+FFFF_=_ef_bf_bf_=_"?"_______________________________________| | 251 | 0110_5.3.2__U+FFFF_=_ef_bf_bf_=_"?"_______________________________________| |
252 | ' "" "" | 252 | ' "" "" |
253 | 253 | ||
254 | rm -rf ls.testdir 2>/dev/null | ||
255 | mkdir ls.testdir || exit 1 | ||
256 | |||
257 | # testing "test name" "command" "expected result" "file input" "stdin" | ||
258 | |||
259 | testing "ls symlink_to_dir" \ | ||
260 | "touch ls.testdir/A ls.testdir/B; ln -s ls.testdir ls.link; ls ls.link; ls -1 ls.link/; ls -1 ls.link; rm -f ls.link" \ | ||
261 | "A\nB\nA\nB\nA\nB\n" \ | ||
262 | "" "" | ||
263 | |||
254 | # Clean up | 264 | # Clean up |
255 | rm -rf ls.testdir 2>/dev/null | 265 | rm -rf ls.testdir 2>/dev/null |
256 | 266 | ||