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: Bas van Gompel
Subject: Re: [patch] find/pred.c: basename versus base_name.
Date: Thu, 3 Feb 2005 20:12:07 +0100 (MET)
User-agent: slrn/0.9.8.1 (Win32) Hamster/2.0.6.0 Korrnews/4.2

Op Thu, 3 Feb 2005 01:40:16 +0300 schreef Dmitry V. Levin
in <address@hidden>:
[...]
:  On Wed, Feb 02, 2005 at 10:57:40PM +0100, Bas van Gompel wrote:
: > Trying to get findutils to build on cygwin, I needed to apply following
: > patch. It now builds (and runs) fine for me.
: >
: >
: > 2005-02-02  Bas van Gompel  <address@hidden>
: >
: >     * find/pred.c (pred_exec): Use base_name, not basename.
: >     (pred_ok): Ditto.
:
:  Thank you for report.
:
:  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>

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


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.)

(The leading `./' seems not to be needed ever, AFAICT.)


L8r,

Buzz.
-- 
  ) |  | ---/ ---/  Yes, this | This message consists of true | I do not
--  |  |   /    /   really is |   and false bits entirely.    | mail for
  ) |  |  /    /    a 72 by 4 +-------------------------------+ any1 but
--  \--| /--- /---  .sigfile. |   |perl -pe "s.u(z)\1.as."    | me. 4^re




reply via email to

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