[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #20970] Trailing slash on directory arguments breaks -name
From: |
Ross Kendall Axe |
Subject: |
[bug #20970] Trailing slash on directory arguments breaks -name |
Date: |
Tue, 04 Sep 2007 18:34:41 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6 |
Follow-up Comment #2, bug #20970 (project findutils):
Just for fun, I tried it on FreeBSD as well, with identical results to GNU
find. I had intuitively assumed that the -name thing was a no-brainer, for
basically the reasons you mentioned (though I don't have a copy of POSIX
available), but it seems like this odd behaviour is quite common. Either way,
I was surprised as hell when "find /usr/man/ -name 'man?*'" matched /usr/man
itself, and I shall try to avoid trailing slashes in my scripts or use
-wholename or -samefile from now on to work around this corner case.
As for the trailing slash in the output, that's a good point about symlinks.
I'm even more convinced now that that's probably best left alone.
Two things immediately spring to mind about multiple trailing slashes in the
output:
1) I would expect "find foo// -wholename foo//" to match, so maybe some care
would need to be taken (should "find foo// -wholename foo/" also match?), and
2) Processing the output with sed or somesuch might break for similar reasons
if the extra slashes were removed (although -printf is probably better for
most things you could do with sed).
Things like that make me think that probably only -name is worth changing,
especially since "tr -s /" gets rid of the extra slashes easily enough. :-)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?20970>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/