Re: [bug #61774] Docs for find -delete out of sync

2022-01-31 Thread admin4

Hello,

updating the manpage sounds good, but maybe find also needs an 
update/patch, as it (imho) does not work correctly (with the find . 
-delete) as intended?


# warning! this can ruin one's day

mkdir temp
cd temp
touch 1 2 3 f25020672.avi

# only finds that file
find . -name "*f25020672.avi*"
./f25020672.avi

# DANGER! THIS DELETES ALL (!!!) FILES IN THE CURRENT DIRECTORY! (NOT ONLY THE 
-name “*FILES*” SPECIFIED )
find . -delete -name "*f25020672.avi*" <- why does it do that? it is like it 
completely ignores anything after -delete X-D (and just deletes everything in the current 
dir)

# this would have been the correct way to do it
find . -name "*f25020672.avi*" -delete

https://dwaves.de/2021/12/20/be-careful-with-find-delete-find-delete-name-vs-find-name-delete/

On 1/31/22 00:57, Bernhard Voelker wrote:

Update of bug #61774 (project findutils):

   Status:None => Code Review
  Assigned to:None => berny
Fixed Release:None => 4.9.0

 ___

Follow-up Comment #1:

Thanks for the report and the suggested patch.

The formatting for the Texinfo changes were not ideal
(e.g. it is better to use a "@quotation" environment for
a warning block.

Also "Because -delete implies @samp{-delete}, ..." was obviously wrong.

I tried further to improve and unify the -delete description
in the attached git patch.
Okay to push in your name?

Thanks & have a nice day,
Berny

(file #52778)
 ___

Additional Item Attachment:

File name: 0001-doc-improve-description-of-find-delete.patch Size:5 KB






 ___

Reply to this item at:

   

___
   Message sent via Savannah
   https://savannah.gnu.org/




Re: [bug #61774] Docs for find -delete out of sync

2022-02-01 Thread admin4

hello,

first of thanks all for the hard work:

get the point, left to right processing of arguments, okay but, when 
someone reads or writes this one-liner:


find . -delete -name "*f25020672.avi*"

nobody would have guessed that it will delete everything (send this one liner 
to 10x friends and ask them (without trying it out! so maybe in person or in a 
videocall) what this one-liner will do...

will bet ahttps://ko-fi.com/  that 90%  will say "it will delete this file

f25020672.avi and all files that are similar like ABCf25020672.aviABC

cu

On 1/31/22 22:35, Bernhard Voelker wrote:

find(1) was asked to
- start a search in the current directory ".",
- and to delete all files and directories (implicitly using -depth),
- and then to apply the filter for -name '*.avi'.
As the whole command line has already an action (-delete), find does not
implicitly add the default action (-print), and therefore nothing happens
after -name.


Re: [bug #61774] Docs for find -delete out of sync

2022-02-02 Thread admin4

no worries, this will be the last feedback to this problem-challenge.

Beyond clearly documenting how to use the tool (which I think we do)
I'm not sure what to do about the risk that admin4 is pointing out.


but the UNIX philosophy is to simplify, simplify, simplify,and pretty 
much follow that principle and it works wonders :)


what about simplifying the usability & build in fail safes?

so everyone here says it is intended behavior that find -delete -name 
"*searchforthis*" just deletes everything under the current dir .


ok, guess there will have to be a find2 then


Well, other than making the user pass a quiz on how to use it the
first time they invoke it, which isn't at all in the spirit of Unix
and would be hard to do in a POSIX-compliant way that wasn't deeply
user-surprising.


try it out as root in / and have phun restoring!

this intended behaviour by find forces users to transition from ext4 to zfs or 
btrfs and will still cost 3 years of sorting 1 million photorec restored jpg 
(without the filenames) by hand (until an AI comes up and does the job)

so cu in 2025


Re: [bug #61774] Docs for find -delete out of sync

2022-02-02 Thread admin4

me so lucky: it's only 603283 jpgs to sort manually...





Re: [bug #61774] Docs for find -delete out of sync

2022-02-02 Thread admin4

nah my mistake now got it:

simplify in this context means: find should get rid of the -delete 
("simplify")


because, (UNIX Philosophy)

 * *Write programs that do one thing and do it well.*
 * *Write programs to work together.*
 * *Write programs to handle text streams, because that is a universal
   interface.*

find . -name *.doc -exec rm -rf {} \; # does the same as find . -name 
*.doc -delete


Malcolm Douglas McIlroy : 
“Everything was small… and my heart sinks for Linux when I see the size 
of it. […]


The manual page , which really 
used to be a manual /page/, is now a small volume, with a thousand options…


*We used to sit around in the Unix Room saying, ‘What can we throw out? 
Why is there this option?’*


*It’s often because there is some deficiency in the basic design* — you 
didn’t really hit the right design point.


Instead of adding an option, think about what was forcing you to add 
that option.” (src: https://en.wikiquote.org/wiki/Doug_McIlroy)


https://dwaves.de/2017/05/02/the-unix-philosophy-simple-and-beautiful-so-it-just-works/

PS: "encourage close communication" why has communications become so 
little fun? X-D https://ytpak.net/watch?v=JoVQTPbD6UY


ok that's gonna be the last mail because do not want to bother