Subject: Re: CVS commit: src/usr.bin/find
To: None <source-changes@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: source-changes
Date: 10/22/2005 17:30:35
On Fri, Oct 21, 2005 at 22:59:13 -0400, Christos Zoulas wrote:

> | Christos Zoulas wrote:
> | 
> | > But that is a special case, it is not path normalization which
> | > they don't do.  They are not really trimming trailing slashes or
> | > anything. We can do the same too.
> | 
> | Should we?
> 
> Maybe so that we are compatible with everyone else

Doesn't this open a can worms?  What do we do with several trailing
slashes?  E.g. my FreeBSD box does:

$ find /bin | sed 2q
/bin
/bin/cat
$ find /bin/ | sed 2q
/bin/				# shall we drop this one too?
/bin/cat
$ find /bin// | sed 2q
/bin//
/bin//cat

Things get more interesting if the path is a symlink to the directory.

$ find /home
/home
$ find /home/ | sed 2q
/home/				# <- cannot drop this one
/home/uwe

What if the output from find is intended to be used as part of some
other name?

$ find /usr/src/ -type d | while read d; do echo $d/CVS; done
/usr/src//CVS
/usr/src/lib/CVS
...

Does the double slash in the first line bothers you too?

As Christoph pointed out earlier in the thread, it's not always a good
idea for a program to try to get "helpful".

I mean, find *works*.  The names it prints are correct pathnames that
resolve to the files you expect.  Does minor eye candy really worth
the trouble?

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen