Bug 31075 - `find -exec' emits spurious warnings
`find -exec' emits spurious warnings
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: findutils (Show other bugs)
6.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Crutcher Dunnavant
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-03-08 12:04 EST by Dimitri Papadopoulos
Modified: 2007-04-18 12:32 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-03-28 05:20:33 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dimitri Papadopoulos 2001-03-08 12:04:00 EST
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 12:53:59 EST
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 12:55:44 EST
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 05:20:28 EST
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 11:26:14 EST
find . -name dummy | xargs rmdir

Note You need to log in before you can comment on or make changes to this bug.