[Top][All Lists]

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

[bug #20802] find -delete anomalies

From: Eric Blake
Subject: [bug #20802] find -delete anomalies
Date: Fri, 17 Aug 2007 17:42:31 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070725 Firefox/


                 Summary: find -delete anomalies
                 Project: findutils
            Submitted by: ericb
            Submitted on: Friday 08/17/2007 at 11:42
                Category: find
                Severity: 3 - Normal
              Item Group: Wrong result
                  Status: Confirmed
                 Privacy: Public
             Assigned to: None
         Originator Name: Eric Blake
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.3.8
           Fixed Release: None



Shouldn't a failed -delete cause a non-zero exit status, because an error
message was printed to stderr?

$ mkdir a
$ cd a
$ mkdir b
$ touch b/c
$ find -type d -empty -delete
find: cannot delete `./b': Directory not empty
$ echo $?

Or since the -delete action results in false on failure, is it still
necessary to also print to stderr?

Likewise, shouldn't -delete attempt (and fail) to delete ., if it has not
been filtered out by a prior expression (such as via -empty, -type f,
-mindepth, etc.)?  Here, the fact that . is printed without an error means
that find claims to have deleted ., which is inconsistent (note that even on
platforms where you are permitted to remove the current working directory, you
have to do so via the named directory entry in .., rather than via `.').

$ rm b/c
$ rmdir .
rmdir: .: Invalid argument
$ find -type d -delete -print
$ echo $?

It may be worth comparing this bug report to the results of a recent
coreutils thread, asking for a way come up with a list of successfully deleted
leaf directories (including parents that become leaves during the recursion),
while being silent with regards to non-empty directories:


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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