summaryrefslogtreecommitdiff
path: root/src/ls.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2007-01-02 07:27:22 +0100
committerJim Meyering <jim@meyering.net>2007-01-02 07:27:22 +0100
commitf0b5e513d901871a3994349322785ac1882eb873 (patch)
tree18f86e0fdff06e92f38e7992d88bae76fd5b66ef /src/ls.c
parent3b8560a63764595791245892cc8bd5877e0af508 (diff)
downloadcoreutils-f0b5e513d901871a3994349322785ac1882eb873.tar.xz
Now, "ls -FRL" always follows symbolic links on Linux.
* NEWS: Mention this bug fix. * src/ls.c (gobble_file): Fix bug reported by Nobuyuki Tsuchimura in http://lists.gnu.org/archive/html/bug-coreutils/2006-12/msg00152.html where "ls -FRL" didn't follow a symbolic link in some cases on Linux. * tests/ls/follow-slink: Add a test for this case. Signed-off-by: Jim Meyering <jim@meyering.net>
Diffstat (limited to 'src/ls.c')
-rw-r--r--src/ls.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/ls.c b/src/ls.c
index 63d363fd2..feba59141 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1,5 +1,5 @@
/* `dir', `vdir' and `ls' directory listing programs for GNU.
- Copyright (C) 85, 88, 90, 91, 1995-2006 Free Software Foundation, Inc.
+ Copyright (C) 85, 88, 90, 91, 1995-2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2534,14 +2534,15 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
direct.d_type), we have to stat it in order to indicate
sticky and/or other-writable attributes. */
|| (type == directory && print_with_color)
- || (print_inode
- && (inode == NOT_AN_INODE_NUMBER
- /* When dereferencing symlinks, the inode must come from
- stat, but readdir provides the inode of lstat. Command
- line dereferences are already taken care of by the above
- assertion that the inode number is not yet known. */
- || (dereference == DEREF_ALWAYS
- && (type == symbolic_link || type == unknown))))
+ /* When dereferencing symlinks, the inode and type must come from
+ stat, but readdir provides the inode and type of lstat. */
+ || ((print_inode || format_needs_type)
+ && (type == symbolic_link || type == unknown)
+ && (dereference == DEREF_ALWAYS
+ || (command_line_arg && dereference != DEREF_NEVER)))
+ /* Command line dereferences are already taken care of by the above
+ assertion that the inode number is not yet known. */
+ || (print_inode && inode == NOT_AN_INODE_NUMBER)
|| (format_needs_type
&& (type == unknown || command_line_arg
/* --indicator-style=classify (aka -F)