Subject: Re: bin/1495: Bad feature in ls(1)
To: None <netbsd-bugs@NetBSD.ORG>
From: Robert Black <r.black@ic.ac.uk>
List: netbsd-bugs
Date: 09/24/1995 18:22:59
On Sep 22,  3:55pm, der Mouse wrote:
> Subject: Re:  bin/1495: Bad feature in ls(1)
> >    "ls -R ./" adds the prefix to the paths as they are printed.  This
> >    results in filenames being printed as .//foo rather than ./foo.
>
> This is a bug?  If you "ls -R .././/foo/./", you'll see pathnames like
> .././/foo/.//bar rather than ../foo/bar - do you call that a bug too?

As far as I can see the alternative would be to stick the path names through
realpath(). The problem with this would be that if you were to use something
like

ls -R /home/foo/bar | xargs ...

where /home/foo was automounted it could lead to all sorts of nastiness.

Maybe it would be appropriate to create a command called "realpath" as a
wrapper around the function call, eg:

ls -R .././/foo/./ | realpath

would give the desired result (except formatting). Come to think of it

ls -R `echo '.././/foo/./' | realpath`

might be a better way to do it in this case.


Cheers

Rob Black

--