bugfindutils - Bugs: bug #63765, Unexpected deletions : find...

 
 

bug #63765: Unexpected deletions : find warnings with missing selection (true bug or half way between bug and non-bug ?)

Submitter:  me <mee>
Submitted:  Sun 05 Feb 2023 10:29:17 PM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  None Status:  Working as Intended
Privacy:  Public Assigned to:  berny
Originator Name:  Open/Closed:  Open
Release:  4.8.0 Fixed Release:  4.9.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 08 Feb 2023 05:31:09 PM UTC, comment #1: 

Those have been unlucky cases, indeed.

Incidentally, I used a bare 'find -delete' the other day myself (consciously)
instead of the usual 'rm -rf *'.

The -delete action is like a sharp knife, and a kitchen chef would never want to
switch to a dull knife once she had a sharp one in her hand.

Re. adding a warning: this wouldn't help much ... as half a second later the
files/directories would be gone as well.

But adding such a warning to the manual is a good thing - which we actually
did in the last release 4.9; here's the commit:

https://git.savannah.gnu.org/cgit/findutils.git/commit/?id=58747d778e

Thus said, I'm sorry for the inconvenience, but at this point I don't
see that we should change the behavior.
As such, I'm marking this as "working as intended" for now.

Bernhard Voelker <berny>
Group administrator
Sun 05 Feb 2023 10:29:17 PM UTC, original submission:  

I read the Warning messages section, plus man's NON-BUGS section and used the "The most efficient and secure method..." in Using the -delete action from 10 Worked Examples / 10.1 Deleting Files.

Context: after tens hours of photorec data recovery from a defective disk I purged unneeded files in the target recovery dir ~/recup this way (I first got ownership of the "recup" tree as recovery worked as root - just to say this "bug" report is not security related):
I visually parsed the hundreds recup sub-folders recup_dir.xxx and to treat the whole tree I issued commands as

me@me:~/recup$ find . -type f -iname *.exe -delete
me@me:~/recup$ find . -type f -iname *_*mui -delete
and so on. At a point I was fed up using left arrow key to traverse back the -delete action to change the pattern so I had the idea to change the order of things like many linux commands allow:
me@me:~/recup$ find . -delete -type f -iname *.chm
which ended, you surely know what, whole tree deletion. Fortunately I had setup a syncthing share for ~/recup , so the deletion of ~/recup/.stfolder immediately broke the synchronisation and I didn't loose any data nor previous work, regards to deleting/recreating the syncthing folder share on working machine which uploaded back the yet worked tree.

The thing is I'm a casual find user that seldom uses find's action and I'm often (although less and less) caught by "find: paths must precede expression:".

From the manual when no start point is given "." is assumed. Trying "find -delete" ATM, I just mkdir ~/test, ... but as I forgot to "cd test" I broke my whole profile with no warning because find then catches everything. I was a bit frightened it would also catch "./.." as ls shows: no need :-(

No way to have a special handling when using -delete and no startpoint is given and+or no target selection like -name or -type or anything ?

me <mee>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by berny (Posted a comment)
  • -email is unavailable- added by mee (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-02-08 berny StatusNone Working as Intended
        Assigned toNone berny
        ReleaseNone 4.8.0
        Fixed Release4.8.0 4.9.0

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code