From mike_makonnen@yahoo.com  Wed Dec 26 01:47:58 2001
Return-Path: <mike_makonnen@yahoo.com>
Received: from mta7.pltn13.pbi.net (mta7.pltn13.pbi.net [64.164.98.8])
	by hub.freebsd.org (Postfix) with ESMTP id 0D71537B416
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 26 Dec 2001 01:47:58 -0800 (PST)
Received: from blackbox.pacbell.net ([64.172.24.78])
 by mta7.pltn13.pbi.net (iPlanet Messaging Server 5.1 (built May  7 2001))
 with ESMTP id <0GOY008QP37XZ2@mta7.pltn13.pbi.net> for
 FreeBSD-gnats-submit@freebsd.org; Wed, 26 Dec 2001 01:47:57 -0800 (PST)
Received: (from mikem@localhost)	by blackbox.pacbell.net (8.11.6/8.11.6)
 id fBQ9xQV00996; Wed, 26 Dec 2001 01:59:26 -0800 (PST envelope-from mikem)
Message-Id: <200112260959.fBQ9xQV00996@blackbox.pacbell.net>
Date: Wed, 26 Dec 2001 01:59:26 -0800 (PST)
From: mikem <mike_makonnen@yahoo.com>
Reply-To: mikem <mike_makonnen@yahoo.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] /bin/ls -dF adds trailing slash regardless of whether there is
 already one there
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         33187
>Category:       bin
>Synopsis:       [PATCH] /bin/ls -dF adds trailing slash regardless of whether there is already one there
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 26 01:50:01 PST 2001
>Closed-Date:    Fri Jan 11 03:43:38 PST 2002
>Last-Modified:  Fri Jan 11 03:45:27 PST 2002
>Originator:     mikem
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD blackbox.pacbell.net 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Fri Dec 21 01:57:15 PST 2001 mikem@blackbox.pacbell.net:/FreeBSD/obj.current/FreeBSD/current/src/sys/BLACKBOX i386


	
>Description:
If a user specifies a directory with a trailing forward slash to
ls -dF, ls adds another trailing '/'.
If you specify /usr/, the output is /usr//.

Among other things, this behaviour will screw up any scripts or programs that chop trailing forward slashes.
	
>How-To-Repeat:
% ls -dF /usr/
  or 
% ls -dF /usr/*/

	
>Fix:
I've included a patch. It was necessary to change the arguments that
print.c:printtype() takes. Also, while fixing this bug it introduces
another subtle bug: if the -G switch is enabled, the trailing backslash
will also be colorized.
for example:
% ls -dFG /usr/ /usr
will output:
/usr/ (where the '/' will be colorized)
/usr/ (where the '/' will *not* be colorized

A simple solution would be to colorize not just the file/dir names, but also
the trailing type specifiers. While it's not good practice to introduce one bug just to fix another, in this case I think the tradeoff is ok. One bug merely makes ls output a little less pretty, while the other one can screw up other programs and scripts.
	
In any case, here's the patch. Do what you will with it.

--- /usr/src/bin/ls/print.c     Tue Nov 27 06:30:05 2001
+++ print.c     Wed Dec 26 00:49:54 2001
@@ -69,7 +69,7 @@
 static int     printaname __P((FTSENT *, u_long, u_long));
 static void    printlink __P((FTSENT *));
 static void    printtime __P((time_t));
-static int     printtype __P((u_int));
+static int     printtype __P((u_int, const char*, u_int len));
 #ifdef COLORLS
 static void     endcolor __P((int));
 static int      colortype __P((mode_t));
@@ -190,7 +190,7 @@
                        endcolor(0);
 #endif
                if (f_type)
-                       (void)printtype(sp->st_mode);
+                       (void)printtype(sp->st_mode, p->fts_name, p->fts_namelen);
                if (S_ISLNK(sp->st_mode))
                        printlink(p);
                (void)putchar('\n');
@@ -301,7 +301,7 @@
                endcolor(0);
 #endif
        if (f_type)
-               chcnt += printtype(sp->st_mode);
+               chcnt += printtype(sp->st_mode, p->fts_name, p->fts_namelen);
        return (chcnt);
 }
 
@@ -334,12 +334,14 @@
 }
 
 static int
-printtype(mode)
-       u_int mode;
+printtype(mode, name, len)
+       const char* name;
+       u_int       mode, len;
 {
        switch (mode & S_IFMT) {
        case S_IFDIR:
-               (void)putchar('/');
+               if (name[len - 1] != '/')
+                       (void)putchar('/');
                return (1);
        case S_IFIFO:
                (void)putchar('|');




>Release-Note:
>Audit-Trail:

From: mikem <mike_makonnen@yahoo.com>
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: bin/33187: [PATCH] /bin/ls -dF adds trailing slash regardless of
 whether there is already one there
Date: Wed, 26 Dec 2001 03:42:12 -0800

 This is a multi-part message in MIME format.
 
 --Boundary_(ID_IIdUyl+tqyey1bOuHiC/Sw)
 Content-type: text/plain; charset=US-ASCII
 Content-transfer-encoding: 7BIT
 
 That patch really didn't sit well with me, so I  wrote another one.
 It was so simple that I wonder why I didn't think of it in the first place.
 Hmm... maybe it's all that X-mas liquor :-)
 
 Anyways, the patch is attached to this email
 
 
 Cheers,
 mikem
 
 --Boundary_(ID_IIdUyl+tqyey1bOuHiC/Sw)
 Content-type: application/octet-stream; name=ls
 Content-transfer-encoding: base64
 Content-disposition: attachment; filename=ls
 
 LS0tIC91c3Ivc3JjL2Jpbi9scy9scy5jCVR1ZSBOb3YgMjcgMDY6MzA6MDUgMjAwMQorKysgbHMu
 YwlXZWQgRGVjIDI2IDAzOjM1OjUwIDIwMDEKQEAgLTEzMiw3ICsxMzIsNyBAQAogewogCXN0YXRp
 YyBjaGFyIGRvdFtdID0gIi4iLCAqZG90YXZbXSA9IHsgZG90LCBOVUxMIH07CiAJc3RydWN0IHdp
 bnNpemUgd2luOwotCWludCBjaCwgZnRzX29wdGlvbnMsIG5vdHVzZWQ7CisJaW50IGNoLCBmdHNf
 b3B0aW9ucywgbm90dXNlZCwgaW5kZXgsIGxlbjsKIAljaGFyICpwOwogCiAjaWZkZWYgQ09MT1JM
 UwpAQCAtMzgyLDYgKzM4MiwxOSBAQAogCQlwcmludGZjbiA9IHByaW50bG9uZzsKIAllbHNlCiAJ
 CXByaW50ZmNuID0gcHJpbnRjb2w7CisKKwkvKgorCSAqIFJlbW92ZSB0cmFpbGluZyAnLycgaWYg
 LWQgYW5kIC1GIGFyZSBzcGVjaWZpZWQKKwkgKiBzbyB3ZSBkb24ndCBnZXQgaW50byB0aGUgc2l0
 dWF0aW9uIHdoZXJlOgorCSAqICUgbHMgLWRGIC91c3IvCisJICogb3V0cHV0czogL3Vzci8vCisJ
 ICovCisJaWYgKGZfbGlzdGRpciAmJiBmX3R5cGUpCisJCWZvcihpbmRleD0wOyBpbmRleCA8IGFy
 Z2MgOyBpbmRleCsrKSB7CisJCQlsZW4gPSBzdHJsZW4oYXJndltpbmRleF0pOworCQkJaWYgKGFy
 Z3ZbaW5kZXhdW2xlbiAtIDFdID09ICcvJykKKwkJCQlhcmd2W2luZGV4XVtsZW4gLSAxXSA9ICdc
 MCc7CisJCX0KIAogCWlmIChhcmdjKQogCQl0cmF2ZXJzZShhcmdjLCBhcmd2LCBmdHNfb3B0aW9u
 cyk7Cg==
 
 --Boundary_(ID_IIdUyl+tqyey1bOuHiC/Sw)--

From: mikem <mike_makonnen@yahoo.com>
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: bin/33187: [PATCH] /bin/ls -dF adds trailing slash regardless of
 whether there is already one there
Date: Wed, 26 Dec 2001 04:00:44 -0800

 ok, let's try this one more time...
 
 --- /usr/src/bin/ls/ls.c	Tue Nov 27 06:30:05 2001
 +++ ls.c	Wed Dec 26 03:35:50 2001
 @@ -132,7 +132,7 @@
  {
  	static char dot[] = ".", *dotav[] = { dot, NULL };
  	struct winsize win;
 -	int ch, fts_options, notused;
 +	int ch, fts_options, notused, index, len;
  	char *p;
  
  #ifdef COLORLS
 @@ -382,6 +382,19 @@
  		printfcn = printlong;
  	else
  		printfcn = printcol;
 +
 +	/*
 +	 * Remove trailing '/' if -d and -F are specified
 +	 * so we don't get into the situation where:
 +	 * % ls -dF /usr/
 +	 * outputs: /usr//
 +	 */
 +	if (f_listdir && f_type)
 +		for(index=0; index < argc ; index++) {
 +			len = strlen(argv[index]);
 +			if (argv[index][len - 1] == '/')
 +				argv[index][len - 1] = '\0';
 +		}
  
  	if (argc)
  		traverse(argc, argv, fts_options);
Responsible-Changed-From-To: freebsd-bugs->sheldonh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Wed Jan 9 05:41:27 PST 2002 
Responsible-Changed-Why:  
I'll take this one. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=33187 

From: Sheldon Hearn <sheldonh@starjuice.net>
To: mikem <mike_makonnen@yahoo.com>
Cc: bug-followup@freebsd.org
Subject: Re: bin/33187: [PATCH] /bin/ls -dF adds trailing slash regardless of whether there is already one there 
Date: Wed, 09 Jan 2002 15:43:38 +0200

 On Wed, 26 Dec 2001 03:50:02 PST, mikem wrote:
 
 >  ok, let's try this one more time...
 
 I like this. :-)
 
 The following variant of your patch makes small stylistic changes:
 
 >  -	int ch, fts_options, notused;
 >  +	int ch, fts_options, notused, index, len;
 
 These new variables should follow the sort order, and index is usually
 called i.
 
 >  +	/*
 >  +	 * Remove trailing '/' if -d and -F are specified
 >  +	 * so we don't get into the situation where:
 >  +	 * % ls -dF /usr/
 >  +	 * outputs: /usr//
 >  +	 */
 
 This comment doesn't look like the rest of the comments.
 
 Ciao,
 Sheldon.
 
 Index: ls.c
 ===================================================================
 RCS file: /home/ncvs/src/bin/ls/ls.c,v
 retrieving revision 1.51
 diff -u -d -r1.51 ls.c
 --- ls.c	29 Dec 2001 00:22:29 -0000	1.51
 +++ ls.c	9 Jan 2002 13:34:48 -0000
 @@ -135,7 +135,7 @@
  {
  	static char dot[] = ".", *dotav[] = {dot, NULL};
  	struct winsize win;
 -	int ch, fts_options, notused;
 +	int ch, fts_options, i, len, notused;
  	char *p;
  #ifdef COLORLS
  	char termcapbuf[1024];	/* termcap definition buffer */
 @@ -392,6 +392,17 @@
  		printfcn = printlong;
  	else
  		printfcn = printcol;
 +
 +	/*
 +	 * If -d and -F options, strip trailing slashes from arguments
 +	 * to avoid duplicated terminating slashes in output.
 +	 */
 +	if (f_listdir && f_type)
 +		for(i=0; i < argc ; i++) {
 +			len = strlen(argv[i]);
 +			if (argv[i][len - 1] == '/')
 +				argv[i][len - 1] = '\0';
 +		}
  
  	if (argc)
  		traverse(argc, argv, fts_options);

From: Ruslan Ermilov <ru@FreeBSD.ORG>
To: Sheldon Hearn <sheldonh@starjuice.net>
Cc: audit@FreeBSD.ORG, bug-followup@FreeBSD.ORG
Subject: Re: bin/33187: ls -dF and trailing slashes
Date: Wed, 9 Jan 2002 16:19:06 +0200

 On Wed, Jan 09, 2002 at 03:51:13PM +0200, Sheldon Hearn wrote:
 > 
 > Hi folks,
 > 
 > What do you think of the following patch, taken from PR bin/33187?
 > 
 > It prevents
 > 
 > 	ls -dF /usr/
 > 
 > from producing
 > 
 > 	/usr//
 > 
 > which may confuse other programs for which this output is used as input.
 > 
 It also doesn't work for ``ls -dF /usr//'' and breaks ``ls -dF /''.
 
 > Index: ls.c
 > ===================================================================
 > RCS file: /home/ncvs/src/bin/ls/ls.c,v
 > retrieving revision 1.51
 > diff -u -d -r1.51 ls.c
 > --- ls.c	29 Dec 2001 00:22:29 -0000	1.51
 > +++ ls.c	9 Jan 2002 13:34:48 -0000
 > @@ -135,7 +135,7 @@
 >  {
 >  	static char dot[] = ".", *dotav[] = {dot, NULL};
 >  	struct winsize win;
 > -	int ch, fts_options, notused;
 > +	int ch, fts_options, i, len, notused;
 >  	char *p;
 >  #ifdef COLORLS
 >  	char termcapbuf[1024];	/* termcap definition buffer */
 > @@ -392,6 +392,17 @@
 >  		printfcn = printlong;
 >  	else
 >  		printfcn = printcol;
 > +
 > +	/*
 > +	 * If -d and -F options, strip trailing slashes from arguments
 > +	 * to avoid duplicated terminating slashes in output.
 > +	 */
 > +	if (f_listdir && f_type)
 > +		for(i=0; i < argc ; i++) {
 > +			len = strlen(argv[i]);
 > +			if (argv[i][len - 1] == '/')
 > +				argv[i][len - 1] = '\0';
 > +		}
 >  
 >  	if (argc)
 >  		traverse(argc, argv, fts_options);
 
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
State-Changed-From-To: open->suspended 
State-Changed-By: sheldonh 
State-Changed-When: Wed Jan 9 06:46:28 PST 2002 
State-Changed-Why:  
There doesn't seem to be an easy way to handle this.  For now, 
it's probably better to simply fix scripts that use ls -dF 
output. 

For the record, I'm pretty sure I remember POSIX warning against 
relying on the output of ls(1) in scripts. 


Responsible-Changed-From-To: sheldonh->freebsd-bugs 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Wed Jan 9 06:46:28 PST 2002 
Responsible-Changed-Why:  
Leave this one for another brave soul. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=33187 

From: Bruce Evans <bde@zeta.org.au>
To: Ruslan Ermilov <ru@FreeBSD.ORG>
Cc: Sheldon Hearn <sheldonh@starjuice.net>, <audit@FreeBSD.ORG>,
	<bug-followup@FreeBSD.ORG>
Subject: Re: bin/33187: ls -dF and trailing slashes
Date: Thu, 10 Jan 2002 15:04:31 +1100 (EST)

 On Wed, 9 Jan 2002, Ruslan Ermilov wrote:
 
 > On Wed, Jan 09, 2002 at 03:51:13PM +0200, Sheldon Hearn wrote:
 > >
 > > Hi folks,
 > >
 > > What do you think of the following patch, taken from PR bin/33187?
 > >
 > > It prevents
 > >
 > > 	ls -dF /usr/
 > >
 > > from producing
 > >
 > > 	/usr//
 > >
 > > which may confuse other programs for which this output is used as input.
 > >
 > It also doesn't work for ``ls -dF /usr//'' and breaks ``ls -dF /''.
 
 It also breaks ls of symlinks.  E.g.:
 
     $ ls -lF /var/crash /var/crash/
     lrwxr-xr-x  1 root  wheel  8 Mar  5  2001 /var/crash@ -> /c/crash
 
     /var/crash/:
     total 145202
     -rw-r--r--  1 4294967294  wheel          2 Jan  9 14:44 bounds
     -rw-r--r--  1 4294967294  wheel    2630180 Jan  9 14:45 kernel.4
     -rw-r--r--  1 root        wheel          5 May 19  1994 minfree
     -rw-------  1 4294967294  wheel   14680064 Nov 24 21:06 vmcore.1
     -rw-------  1 4294967294  wheel    1048576 Nov 24 21:09 vmcore.2
     -rw-------  1 4294967294  wheel    7053312 Jan  7 14:16 vmcore.3
     -rw-------  1 4294967294  wheel  268435456 Jan  9 14:45 vmcore.4
 
 I think the slash should be stripped in the output at most.
 
 Bruce
 

From: Mike Makonnen <mike_makonnen@yahoo.com>
To: Ruslan Ermilov <ru@freebsd.org>
Cc: sheldonh@starjuice.net, audit@freebsd.org,
	bug-followup@freebsd.org
Subject: Re: bin/33187: ls -dF and trailing slashes
Date: Thu, 10 Jan 2002 02:24:30 -0800

 On Wed, 9 Jan 2002 16:19:06 +0200
 Ruslan Ermilov <ru@freebsd.org> wrote:
 
 > > 
 > It also doesn't work for ``ls -dF /usr//'' and breaks ``ls -dF /''.
 > 
 
 Ok, the issue is a bit more complicated than I thought at first. 
 
 Anyways, regardless of the patch, it seems ls(1) accepts the following:
 ``ls -dF /usr////////////////''. It seems like ls(1) (or rather the fts_* family of functions) doesn't care how many trailing '/' there are. Is this a possible bug in fts_*? Anyone know what POSIX has to say about this?
 
 
 Cheers,
 mike makonnen

From: Mike Makonnen <mike_makonnen@yahoo.com>
To: Bruce Evans <bde@zeta.org.au>
Cc: ru@freebsd.org, sheldonh@starjuice.net, audit@freebsd.org,
	bug-followup@freebsd.org
Subject: Re: bin/33187: ls -dF and trailing slashes
Date: Thu, 10 Jan 2002 02:33:25 -0800

 On Thu, 10 Jan 2002 15:04:31 +1100 (EST)
 Bruce Evans <bde@zeta.org.au> wrote:
 
 > It also breaks ls of symlinks.  E.g.:
 > 
 >     $ ls -lF /var/crash /var/crash/
 >     lrwxr-xr-x  1 root  wheel  8 Mar  5  2001 /var/crash@ -> /c/crash
 > 
 >     /var/crash/:
 >     total 145202
 >     -rw-r--r--  1 4294967294  wheel          2 Jan  9 14:44 bounds
 >     -rw-r--r--  1 4294967294  wheel    2630180 Jan  9 14:45 kernel.4
 >     -rw-r--r--  1 root        wheel          5 May 19  1994 minfree
 >     -rw-------  1 4294967294  wheel   14680064 Nov 24 21:06 vmcore.1
 >     -rw-------  1 4294967294  wheel    1048576 Nov 24 21:09 vmcore.2
 >     -rw-------  1 4294967294  wheel    7053312 Jan  7 14:16 vmcore.3
 >     -rw-------  1 4294967294  wheel  268435456 Jan  9 14:45 vmcore.4
 
 I realize the pr has been suspended, but just to set the record straight...
 this is not caused by the patch. The patch only comes into effect when both -d and -F are specified.
 
 >     I think the slash should be stripped in the output at most.
 
 Yeah, you're right. I also just found out ls(1) will accept ``ls /usr////////''. So, should all trailing '/' be stripped on output or is it not
 worth the effort/POSIX compliance/whatever ?
 
 Cheers,
 mike makonnen
 

From: Bruce Evans <bde@zeta.org.au>
To: Mike Makonnen <mike_makonnen@yahoo.com>
Cc: <ru@freebsd.org>, <sheldonh@starjuice.net>, <audit@freebsd.org>,
	<bug-followup@freebsd.org>
Subject: Re: bin/33187: ls -dF and trailing slashes
Date: Thu, 10 Jan 2002 23:38:47 +1100 (EST)

 On Thu, 10 Jan 2002, Mike Makonnen wrote:
 
 > On Thu, 10 Jan 2002 15:04:31 +1100 (EST)
 > Bruce Evans <bde@zeta.org.au> wrote:
 >
 > > It also breaks ls of symlinks.  E.g.:
 > >
 > >     $ ls -lF /var/crash /var/crash/
 > >     lrwxr-xr-x  1 root  wheel  8 Mar  5  2001 /var/crash@ -> /c/crash
 > >
 > >     /var/crash/:
 > >     total 145202
 > >     -rw-r--r--  1 4294967294  wheel          2 Jan  9 14:44 bounds
 > >     -rw-r--r--  1 4294967294  wheel    2630180 Jan  9 14:45 kernel.4
 > >     -rw-r--r--  1 root        wheel          5 May 19  1994 minfree
 > >     -rw-------  1 4294967294  wheel   14680064 Nov 24 21:06 vmcore.1
 > >     -rw-------  1 4294967294  wheel    1048576 Nov 24 21:09 vmcore.2
 > >     -rw-------  1 4294967294  wheel    7053312 Jan  7 14:16 vmcore.3
 > >     -rw-------  1 4294967294  wheel  268435456 Jan  9 14:45 vmcore.4
 >
 > I realize the pr has been suspended, but just to set the record straight...
 > this is not caused by the patch. The patch only comes into effect when both -d and -F are specified.
 
 I forgot it was -d and my fingers knew it was -l :-).  Anyway, "ls -dF
 /var/crash/" should follow the symlink (if any).  Appending a slash
 is a normal way to get symlinks followed.  For ls, you can use -L, but
 most utilities don't have an equivalent.
 
 > >     I think the slash should be stripped in the output at most.
 >
 > Yeah, you're right. I also just found out ls(1) will accept ``ls /usr////////''. So, should all trailing '/' be stripped on output or is it not
 > worth the effort/POSIX compliance/whatever ?
 
 I doubt that POSIX specifies the output of ls in enough detail to say, but
 I think stripping should not change the semantics of the pathnames, in
 case they are used for input.  Stripping "//" to "/" changes the semantics,
 as does stripping "foo/" to "foo" if "foo" is not a directory.  Otherwise,
 trailing slashes may be stripped without changing the semantics.
 
 Bruce
 

From: Ruslan Ermilov <ru@freebsd.org>
To: Bruce Evans <bde@zeta.org.au>
Cc: Mike Makonnen <mike_makonnen@yahoo.com>, sheldonh@starjuice.net,
	audit@freebsd.org, bug-followup@freebsd.org
Subject: Re: bin/33187: ls -dF and trailing slashes
Date: Fri, 11 Jan 2002 09:34:14 +0200

 On Thu, Jan 10, 2002 at 11:38:47PM +1100, Bruce Evans wrote:
 > On Thu, 10 Jan 2002, Mike Makonnen wrote:
 > 
 > > On Thu, 10 Jan 2002 15:04:31 +1100 (EST)
 > > Bruce Evans <bde@zeta.org.au> wrote:
 > >
 > > > It also breaks ls of symlinks.  E.g.:
 > > >
 > > >     $ ls -lF /var/crash /var/crash/
 > > >     lrwxr-xr-x  1 root  wheel  8 Mar  5  2001 /var/crash@ -> /c/crash
 > > >
 > > >     /var/crash/:
 > > >     total 145202
 > > >     -rw-r--r--  1 4294967294  wheel          2 Jan  9 14:44 bounds
 > > >     -rw-r--r--  1 4294967294  wheel    2630180 Jan  9 14:45 kernel.4
 > > >     -rw-r--r--  1 root        wheel          5 May 19  1994 minfree
 > > >     -rw-------  1 4294967294  wheel   14680064 Nov 24 21:06 vmcore.1
 > > >     -rw-------  1 4294967294  wheel    1048576 Nov 24 21:09 vmcore.2
 > > >     -rw-------  1 4294967294  wheel    7053312 Jan  7 14:16 vmcore.3
 > > >     -rw-------  1 4294967294  wheel  268435456 Jan  9 14:45 vmcore.4
 > >
 > > I realize the pr has been suspended, but just to set the record straight...
 > > this is not caused by the patch. The patch only comes into effect when both -d and -F are specified.
 > 
 > I forgot it was -d and my fingers knew it was -l :-).  Anyway, "ls -dF
 > /var/crash/" should follow the symlink (if any).  Appending a slash
 > is a normal way to get symlinks followed.  For ls, you can use -L, but
 > most utilities don't have an equivalent.
 > 
 > > >     I think the slash should be stripped in the output at most.
 > >
 > > Yeah, you're right. I also just found out ls(1) will accept ``ls /usr////////''. So, should all trailing '/' be stripped on output or is it not
 > > worth the effort/POSIX compliance/whatever ?
 > 
 > I doubt that POSIX specifies the output of ls in enough detail to say, but
 > I think stripping should not change the semantics of the pathnames, in
 > case they are used for input.  Stripping "//" to "/" changes the semantics,
 > as does stripping "foo/" to "foo" if "foo" is not a directory.  Otherwise,
 > trailing slashes may be stripped without changing the semantics.
 > 
 Let's not overload our utilities with the stuff like this.  There's nothing
 wrong with trailing slashes if the user so wanted -- for those who doesn't,
 a simple sed(1) sequence would be in place, or realpath(3) from within C.
 More to the point, the multiple slashes in the middle of a pathname are not
 covered by this PR, and I don't see a reason why we should treat trailing
 slashes differently.  I insist on us closing this PR.
 
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age

From: Sheldon Hearn <sheldonh@starjuice.net>
To: Ruslan Ermilov <ru@freebsd.org>
Cc: Bruce Evans <bde@zeta.org.au>,
	Mike Makonnen <mike_makonnen@yahoo.com>, audit@freebsd.org,
	bug-followup@freebsd.org
Subject: Re: bin/33187: ls -dF and trailing slashes 
Date: Fri, 11 Jan 2002 13:22:06 +0200

 On Fri, 11 Jan 2002 09:34:14 +0200, Ruslan Ermilov wrote:
 
 > I insist on us closing this PR.
 
 No objection from me.
 
 Ciao,
 Sheldon.

From: Mike Makonnen <mike_makonnen@yahoo.com>
To: Ruslan Ermilov <ru@freebsd.org>
Cc: bde@zeta.org.au, sheldonh@starjuice.net, audit@freebsd.org,
	bug-followup@freebsd.org
Subject: Re: bin/33187: ls -dF and trailing slashes
Date: Fri, 11 Jan 2002 03:22:01 -0800

 On Fri, 11 Jan 2002 09:34:14 +0200
 Ruslan Ermilov <ru@freebsd.org> wrote:
 
 > slashes differently.  I insist on us closing this PR.
 
 Fine with me.
 
 
 Cheers,
 mike makonnen
State-Changed-From-To: suspended->closed 
State-Changed-By: ru 
State-Changed-When: Fri Jan 11 03:43:38 PST 2002 
State-Changed-Why:  
Originator agreed this PR can be closed for reasons 
specified in my last reply. 


Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Fri Jan 11 03:43:38 PST 2002 
Responsible-Changed-Why:  

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=33187 
>Unformatted:
