bug-findutils
[Top][All Lists]
Advanced

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

[bug #20865] -delete interacts with -prune


From: anonymous
Subject: [bug #20865] -delete interacts with -prune
Date: Wed, 22 Aug 2007 08:50:38 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419.3 (KHTML, like Gecko) Safari/419.3

URL:
  <http://savannah.gnu.org/bugs/?20865>

                 Summary: -delete interacts with -prune
                 Project: findutils
            Submitted by: None
            Submitted on: Wednesday 08/22/2007 at 08:50 UTC
                Category: find
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Bruno De Fraine
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.28
           Fixed Release: None

    _______________________________________________________

Details:

There is a potentially dangerous interaction between -delete and -prune:
-delete turns on -depth, which (in turn) silently disables the effects of
-prune. This caused seemingly inexplicable data loss for me on a number of
occassions before I understood the problem.

This interaction is specifically malicious because it only occurs when you
proceed to deleting. For example, you can use -prune to list only the 'real'
files in a Subversion working copy:
$ find -not "(" -name .svn -type d -prune ")" -type f
./a.txt

If you rerun the command-line with -delete added to the end, intending to
proceed with the deletion of those files, you actually silently delete more,
as only a listing with -depth reveals:
$ find -depth -not "(" -name .svn -type d -prune ")" -type f
./.svn/text-base/a.txt.svn-base
./.svn/entries
./.svn/all-wcprops
./.svn/format
./a.txt

Given that this is documented behavior of two (perhaps ill-considered)
features, is there room for any of the following changes to mitigate this
problem?

* -delete does not turn on -depth implicitly
* issue a warning/error when using -prune in case of -depth
* issue an ad hoc warning/error when detecting the combination of -prune and
-delete
 




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?20865>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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