From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dave Goel Newsgroups: gmane.emacs.devel Subject: Dired delete(d) the wrong file! Date: Thu, 4 Jul 2024 18:36:07 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000614b5f061c739373" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9399"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org, Dave Goel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 05 00:37:07 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sPV4d-0002I1-84 for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Jul 2024 00:37:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPV3w-0003GY-M7; Thu, 04 Jul 2024 18:36:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPV3v-0003GM-K0 for emacs-devel@gnu.org; Thu, 04 Jul 2024 18:36:23 -0400 Original-Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPV3t-0001QR-VG for emacs-devel@gnu.org; Thu, 04 Jul 2024 18:36:23 -0400 Original-Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2c96187b3d1so688723a91.3 for ; Thu, 04 Jul 2024 15:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720132580; x=1720737380; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=JpvXCd0SnPozbkZH4wuiaQHt2KPbRxLDmB45VeWdQeI=; b=F1SzBtTG5XrfsLK/PQRtzQPs6JPc5LvOv3x+1b70MZTSM/tpSqAOwjeCqcjOR54z93 uNg8wAIzqJbjk18fotqAgATkNtkVgnPOfQHsSHAqUhlPG/KRFlxzUlGPtgldyIt354XO RSUeUU8q/zDWuXxYQPguZIC/DT6hFINg8Afw4SLu77brHK+9h+nV6iX4zpO+QiIYRkoc M2EGtL4a9/7OA9jBfkNq8wpa3peNT40LI1FfSCMBBMxwWvLJkWTV4wj0DknS3xdC/7xO XMUF17H7uVqX8RwsckoZYuDohmOGp33yZFKPNahZU48idThT7COh+AeW/TSkyS7BOvDg TxMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720132580; x=1720737380; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JpvXCd0SnPozbkZH4wuiaQHt2KPbRxLDmB45VeWdQeI=; b=wJE89/V/XEmsrOxKsIozihMDYvp/uDVHDlF8ZlfXjILmxCKZQnwKClNMVx02Uc+ag4 nlnId5ddh27IqHTqjKGdQW+Cz8Sf2Ek56Zb7Tci4aHOvlPjwmO/1HE3pdNDEBA13dBKf brtd0vnAAi/2SaPACAmQQyo/ClyHVFJ3xGy2ZGPLJ48Rm+GCXIvdGrUS7DXt+jZobX5I YPIRKevsZlA2IVQ95Dvyb1EDEwTF1Bpnea0TNDWVQbnklMeqU2dZYdUCmWOQ+Wmk02Qd KUq9lqFftUQFnkV/x1Sr09PS++/n01g7VzQYJDNecAv2pyX2xY36CfmGB8WKXRM27bSZ aocw== X-Gm-Message-State: AOJu0YyNGqMh7Vwj4Qf6bJF8mXaRHpn2He7/oUngeL55gLcZQd6OIeOI gS5jPSLymfLG3WT1Uwl+HycQFfCeajqOVA7IcB+fBuOwQ2Ffppv9xx4voWLNhZ4F71rRsUgcW0U VkVNkeyNOKZvNLYj3MZRW5uNix1ECLHXj X-Google-Smtp-Source: AGHT+IFtGUF0zOXbkdYUS+K2ZLVlSJ2m996fVOe/CWiqFwj1NT6RrOqAmOhN4hmIejJlgX6BCqY6700kyaozg/8YMMQ= X-Received: by 2002:a17:90a:69a3:b0:2c7:3e4c:e782 with SMTP id 98e67ed59e1d1-2c99c3e03f9mr2275114a91.0.1720132579705; Thu, 04 Jul 2024 15:36:19 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=deego3@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321362 Archived-At: --000000000000614b5f061c739373 Content-Type: text/plain; charset="UTF-8" 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? --000000000000614b5f061c739373 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Dired deleted the wrong file for me, IRL= ! =C2=A0

But, I guess I don't know if this qualifies as a bug. <= br>
Maybe the emacs user is supposed to be forewarned - =C2=A0"Buye= r beware, dired uses regexps, duh! heuristics always have fail cases"?=

On the other hand, if it's a "buyer beware", maybe w= e 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 debug= ging - dired uses heuristics, and this means you can delete/rename/edit the= wrong file. =C2=A0

Example - touch two files in tmp/
"09 a= a 3333 kk.mmn" and "kk.mmn". =C2=A0

Now, do some oper= ation on the first file using any of dired=C2=A0(or wdired) operations, exa= mple delete it d and x. =C2=A0

Guess which file you actually deleted= ?

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

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 chan= ged?=C2=A0 I see from github that the structure and mechanism is still very= much the same =C2=A0in 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 filen= ames =C2=A0- it stops working if you make the first number too large, say 4= 3. =C2=A0but, 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 curiou= s - 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?
=

--000000000000614b5f061c739373--