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:  Closed
Release:  4.8.0 Fixed Release:  4.9.0
* Mandatory Fields

Add a New Comment Rich Markup

Sun 26 May 2024 08:53:32 PM UTC, comment #4: 

That would be a backward-incompatible change.

James Youngman <jay>
Group administrator
Sun 26 May 2024 05:36:01 PM UTC, comment #3: 

Well when I suggested to add a warning, it was not in the way you describe (Warn then execute, which is not useful). Instead I thought of a stopping warning showing, in these special use case, a "This will delete anything in the implicit path, proceed anyway ? [Y|n]" or "This will delete anything in the specified path, proceed anyway ? [Y|n]" in the same way apt-get install does
This would require a --yes|-y additional parameter to explicitly bypass the message.

me <mee>
Sun 26 May 2024 12:37:45 PM UTC, comment #2: 

Marked as WAI for a year, time to close this I think.

James Youngman <jay>
Group administrator
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:


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:

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 jay (Posted a comment)
  • -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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-05-26 jay Open/ClosedOpen Closed
    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.13-b921.
    Corresponding source code