Bug 4561

Summary: 'ls' no longer honors trailing slash for directory
Product: [Retired] Red Hat Linux Reporter: greerga
Component: fileutilsAssignee: David Lawrence <dkl>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 6.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-08-23 14:48:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description greerga 1999-08-17 06:09:52 UTC
1) ln -s /tmp foo
2) ls -l foo
3) ls -l foo/

RedHat 5.2 (fileutils 3.16) will list the directory while
RedHat 6.0 (fileutils 4.0) will list the symlink twice.
I submit that the behavior is annoying, tedious, and a fix
for a non-existant problem.  The relevant ChangeLog entry
reads:

Wed Feb 19 22:06:32 1997  Jim Meyering
<meyering@na-net.ornl.gov>

        * src/ls.c (main): Remove trailing slashes from
command line arguments.
        Otherwise, running `mkdir x; chmod 644 x; ls -d x/'
(note the trailing
        slash) makes ls fail with permission denied on at
least Linux 1.2.13
        and 2.0.14 systems.

A 2.0.36 kernel does indeed say permission denied but RedHat
6.0 does not use a 2.0.x kernel and it works just fine with
the 2.2.x kernels.  Having the symbolic link listed when an
explicit slash is written makes no sense.  A trivial fix
would be this:

--- ./ls.c	Tue Aug 17 02:06:11 1999
+++ ./ls.c~	Tue Aug 17 02:07:02 1999
@@ -733,6 +733,7 @@
     dir_defaulted = 0;
   for (; i < argc; i++)
     {
-      strip_trailing_slashes (argv[i]);
       gobble_file (argv[i], 1, "");
     }

-George Greer

Comment 1 Preston Brown 1999-08-23 14:48:59 UTC
fixed in fileutils-4.0-3, available in the next release.