bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] find/pred.c: basename versus base_name.


From: Dmitry V. Levin
Subject: Re: [patch] find/pred.c: basename versus base_name.
Date: Thu, 3 Feb 2005 22:38:58 +0300

On Thu, Feb 03, 2005 at 08:12:07PM +0100, Bas van Gompel wrote:
[...]
> :  However, in this case neither basename nor base_name should be used, see
> :  https://savannah.gnu.org/patch/?func=detailitem&item_id=3701#comment1
> :  for details.
> 
> I agree something is wrong there, but I'd say it isn't what you seem
> to think.
> 
> testcase:
> cd /tmp
> find  /usr/bin -mindepth 0 -maxdepth 0 -type d \
> -exec pwd \; \
> -exec echo {} \; \
> -execdir pwd \; \
> -execdir echo {} \; \
> -execdir ls -ld {} \;
> 
> It's output:
> /tmp
> /usr/bin
> /tmp
> ./bin
> ls: ./bin: No such file or directory
> 
> I was, on reading (the security section of) the info page, expecting:
> /tmp
> /usr/bin
> /usr
> ./bin
> <listing of ./bin, starting from /usr>

I expect (and my change makes) following behavior:
/tmp
/usr/bin
/tmp
/usr/bin
<listing of /usr/bin directory without its contents>

> Or even (only at depth 0):
> /tmp
> /usr/bin
> /usr/bin
> ./.
> <listing of ./., starting from /usr/bin>

This interpretation looks reasonable, too.

> The directory doesn't appear to be set correctly during [exec|ok]dir.
> 
> Also `find -[exec|ok]dir {} +' needs to split matches based on which
> directory they are found in, in order to execute the commands while
> still cd'd to that dir. (Execute before leaving dir.)


-- 
ldv

Attachment: pgp1se0PS4Jdb.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]