bug-findutils
[Top][All Lists]
Advanced

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

Re: find acting weird


From: Юрий Пухальский
Subject: Re: find acting weird
Date: Thu, 27 May 2010 12:31:28 +0400

2010/5/26 Eric Blake <address@hidden>:
> On 05/26/2010 09:53 AM, Юрий Пухальский wrote:
>> So goes the standard. It's not clear (for me) what means "all entries
>> in a directory". In this case it depends on whether we consider it
>> before or after -exec.
>>
>>>
>>> You will not get the error if you tell find to do a depth-first search:
>>>
>>> find . -depth -name a -exec rm -rf {} \;
>> Yes, or using the + works. But the question is whether this behaviour
>> is correct. I've tried it on HP-UX:
>> mk2HPX04:/build/mk2HPX04/tmp>mkdir -p a/b
>> mk2HPX04:/build/mk2HPX04/tmp>find . -name a -exec rm -rf {} \;
>> mk2HPX04:/build/mk2HPX04/tmp>
>
> Bug in HP-UX - they are not detecting a valid error case of the
> directory disappearing out from underneath the two-stage traversal, due
> to the -exec action.
>
>>
>> and on AIX:
>> mk2AIX03:/build/mk2AIX03/tmp>mkdir -p a/b
>> mk2AIX03:/build/mk2AIX03/tmp>find . -name a -exec rm -rf {} \;
>> find: 0652-081 cannot change directory to </build/mk2AIX03/tmp/a>:
>>   : A file or directory in the path name does not exist.
>> mk2AIX03:/build/mk2AIX03/tmp>
>
> Same behavior as GNU findutils, as required by POSIX.
Can You please tell where it's required? I'm using
http://www.opengroup.org/onlinepubs/009695399/utilities/find.html and
see nothing about the traversal algorithm.
I can only quote this: "If a -depth primary is not specified, all
entries in a directory shall be acted on after the directory itself."
It can be read either as "all entries in a directory, that are present
after -exec" or "all entries in a directory, that were present before
-exec".

-- 
«The good thing about standards is there are so many to choose from.»



reply via email to

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