all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Dired delete(d) the wrong file!
@ 2024-07-04 22:36 Dave Goel
  2024-07-04 23:35 ` Dave Goel
  2024-07-05  1:24 ` Po Lu
  0 siblings, 2 replies; 21+ messages in thread
From: Dave Goel @ 2024-07-04 22:36 UTC (permalink / raw)
  To: emacs-devel, Dave Goel

[-- Attachment #1: Type: text/plain, Size: 1802 bytes --]

Dired deleted the wrong file for me, IRL!

But, I guess I don't know if this qualifies as a bug.

Maybe the emacs user is supposed to be forewarned -  "Buyer beware, dired
uses regexps, duh! heuristics always have fail cases"?

On the other hand, if it's a "buyer beware", maybe we need to communicate
this better? I have been an emacs "power?" user for upwards of two decades,
and I never knew or thought about it till I encountered this real-life
corruption.


TIL after lots of debugging - dired uses heuristics, and this means you can
delete/rename/edit the wrong file.

Example - touch two files in tmp/
"09 aa 3333 kk.mmn" and "kk.mmn".

Now, do some operation on the first file using any of dired (or wdired)
operations, example delete it d and x.

Guess which file you actually deleted?

And you can see why it happens - the regexes it uses in dired-get-filename
(and other places).

I reproduced these on my emacs 28.2 on debian stable, and reproduced on
27.1 ubunutu.

Mekeor (irc) couldn't reproduce this on 30.0.50 build.

Have the regexps changed?  I see from github that the structure and
mechanism is still very much the same  in the bleeding edge -

dired-get-filename
directory-listing-before-filename-regexp

.. to get the file name.

When you have regexps, the problem always remains? And, it did bit me IRL.


Lots of fun curiosities as you play around with the filenames  - it stops
working if you make the first number too large, say 43.  but, i guess 32,
still looks like a date to the regexp. The regexp probably likes to 0-3 to
filter for dates, etc.

(If you are curious - I had a file that started with 07 ... had the date in
it, and a version of it without the date in it. dired deleted the wrong
version for me!)


Is there a way for dired to dtrt? Is regexp the only way?

[-- Attachment #2: Type: text/html, Size: 2228 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-07-06  6:17 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-04 22:36 Dired delete(d) the wrong file! Dave Goel
2024-07-04 23:35 ` Dave Goel
2024-07-05  1:40   ` Dave Goel
2024-07-05  8:01     ` Tassilo Horn
2024-07-05  1:24 ` Po Lu
2024-07-05  5:43   ` Eli Zaretskii
2024-07-05  5:50     ` Dave Goel
2024-07-05  7:33       ` Eli Zaretskii
2024-07-05  8:06         ` Dave Goel
2024-07-05  8:12           ` Dave Goel
2024-07-05  8:26             ` Dave Goel
2024-07-05  8:39               ` Dave Goel
2024-07-05 11:05                 ` Eli Zaretskii
2024-07-05 19:02                   ` Dave Goel
2024-07-05 11:00               ` Eli Zaretskii
2024-07-05  9:53         ` Stefan Kangas
2024-07-05 10:52           ` Eli Zaretskii
2024-07-05 23:28         ` Michael Heerdegen via Emacs development discussions.
2024-07-06  6:17           ` Eli Zaretskii
2024-07-05  5:50     ` Po Lu
2024-07-05  7:11       ` Michael Heerdegen via Emacs development discussions.

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.