delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/12/12/21:23:33

X-Spam-Check-By: sourceware.org
Date: Tue, 12 Dec 2006 18:23:10 -0800
From: David Rothenberger <daveroth AT acm DOT org>
Subject: Re: find -execdir command executed in wrong directory
In-reply-to: <loom.20061206T051857-170@post.gmane.org>
To: cygwin <cygwin AT cygwin DOT com>
Message-id: <457F640E.3050204@acm.org>
MIME-version: 1.0
References: <4576431D DOT 7060803 AT acm DOT org> <loom DOT 20061206T051857-170 AT post DOT gmane DOT org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.666
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 12/5/2006 8:20 PM, Eric Blake wrote:
> David Rothenberger <daveroth <at> acm.org> writes:
> 
>>
>> "find -execdir" seems to be executing the command in the wrong
>> directory. If the file is in /tmp/a/b/c, the command is executed with
>> the current directory /tmp/a/b instead of /tmp/a/b/c. oldfind does the
>> right thing.
> 
> Thanks for the report. I'm forwarding it upstream, and hopefully a patch will 
> be available soon.  The bug only affects the "-execdir {} +" version (you can 
> still use the less efficient "-execdir {} \;").
> 

I've encountered another similar problem. This one seems to be triggered
by a directory that comes after some files in a directory.

% cygcheck -cd findutils
Cygwin Package Information
Package              Version
findutils            4.3.2-3

% mkdir -p /tmp/a/b/c
% touch /tmp/a/b/a{1,2}
% find /tmp/a -type f -print -execdir pwd {} +
/tmp/a/b/a1
/tmp/a/b/a2
pwd: ignoring non-option arguments
/tmp/a/b/c

The last output should have been /tmp/a/b, not /tmp/a/b/c.

% oldfind /tmp/a -type f -print -execdir pwd {} +
/tmp/a/b/a1
/tmp/a/b/a2
pwd: ignoring non-option arguments
/tmp/a/b

If /tmp/a/b/c is removed, it works correctly.

% rmdir /tmp/a/b/c
% find /tmp/a -type f -print -execdir pwd {} +
/tmp/a/b/a1
/tmp/a/b/a2
pwd: ignoring non-option arguments
/tmp/a/b

It also works correctly if the files come after the directory.

% mkdir /tmp/a/b/a0
% find /tmp/a -type f -print -execdir pwd {} +
/tmp/a/b/a1
/tmp/a/b/a2
pwd: ignoring non-option arguments
/tmp/a/b


- --
David Rothenberger                spammer? -> spam AT daveroth DOT dyndns DOT org
GPG/PGP: 0x92D68FD8, DB7C 5146 1AB0 483A 9D27 DFBA FBB9 E328 92D6 8FD8

Love cannot be much younger than the lust for murder.
                -- Sigmund Freud
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBRX9kDr3xOW8bc2dhAQiVtgf/cxP7ntgE3C+/zRARKwRO0kOxyIldRRsr
7/hdyt74yps87+NtTjm3xHAwxf7oWvJyDhJxhxsR6tj57oKYRlLqIwoyNg8PZu5g
TwprPLDIDyd0WTfkHl1r1AJnxVAvQesAOO3JEjcbDLvFDWU1JNYj1SEJw6RI3NCG
UwnD/yCLCP4IRIOT/Ok3ituSygb5JPtoMcvWV4C1WJK6OPYv7gt7etwpBohIH4zm
/w+83kLdWn5n9T+kEYW8dsrN9NH3OblAj2byg9jjuwIJ79SO6f9V3kor8OsU9Le1
LwQsqoLuLcroS/27kgE9hUCa8Q8XdFm5wATIotc6lYurTd0mYG0x5A==
=iyjG
-----END PGP SIGNATURE-----


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019