From owner-freebsd-audit Thu Jan 10 23:35:12 2002 Delivered-To: freebsd-audit@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id B911137B416; Thu, 10 Jan 2002 23:35:04 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g0B7YE908482; Fri, 11 Jan 2002 09:34:14 +0200 (EET) (envelope-from ru) Date: Fri, 11 Jan 2002 09:34:14 +0200 From: Ruslan Ermilov To: Bruce Evans Cc: Mike Makonnen , sheldonh@starjuice.net, audit@freebsd.org, bug-followup@freebsd.org Subject: Re: bin/33187: ls -dF and trailing slashes Message-ID: <20020111093414.B7527@sunbay.com> References: <200201101033.g0AAXPd03715@blackbox.pacbell.net> <20020110232640.R12168-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020110232640.R12168-100000@gamplex.bde.org> User-Agent: Mutt/1.3.23i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message