Bug 31075

Summary: `find -exec' emits spurious warnings
Product: [Retired] Red Hat Linux Reporter: Dimitri Papadopoulos <dimitri.papadopoulos>
Component: findutilsAssignee: Crutcher Dunnavant <crutcher>
Status: CLOSED NOTABUG QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-03-28 10:20:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dimitri Papadopoulos 2001-03-08 17:04:00 UTC
Hi,

Try this:
	$ mkdir dummy
	$ ls -d dummy
	dummy
	$ find . -name dummy -exec rmdir {} \;
	find: ./dummy: No such file or directory
	$ ls -d dummy
	ls: dummy: No such file or directory
	$ 
The `find: ./dummy: No such file or directory' is wrong as far as I can
tell.
It seems that `find' runs some test after -exec, but it should be run
before.

Regards,
Dimitri

Comment 1 Crutcher Dunnavant 2001-03-14 17:53:59 UTC
Not a bug.

find scans the directory, sees dummy, and performs the test -exec rmdir {} \; on
it. The test deletes the file, and returns true. Find tries to touch the file
again, to pass it on the next test (there aren't any, but there could be.).

The file no longer exists, and find complains.

Comment 2 Dimitri Papadopoulos 2001-03-21 17:55:44 UTC
Well, all this explanation is fine except that the Unix 'find' utility
doesn't emit this spurious warning (Solaris, SGI, etc.).

Also this means that I cannot delete directories using find???

Finally I've searched for 'touch' in the find man page and there's no
such thing as 'touch'. Why do you say find "tries to touch the file
again"?

Dimitri


Comment 3 Dimitri Papadopoulos 2001-03-28 10:20:28 UTC
Hi,

Sorry for sounding like a broken record but the more I think about
it,the more I am convinced this is a bug. This explanation is not
satisfactory:
> Find tries to touch the file again, to pass it on the next
> test (there aren't any, but there could be.).

I understand this as "this is correct because this is the way it
is coded". This does not address this issues:
- Not only find emits a warning but it returns an error status.
- This behaviour is different from the behaviour of find on other
  Unix (at least Solaris, Irix, Tru64) systems and is a cause of
  incompatibilities when running scripts- crontabs script would
  not work here.
- How am I supposed to delete directories using find?


Comment 4 Crutcher Dunnavant 2001-03-29 16:26:14 UTC
find . -name dummy | xargs rmdir