GNU bug report logs - #39280
27.0.60; wdired-get-filename ignores first argument

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Sat, 25 Jan 2020 20:06:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 27.0.60

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39280 in the body.
You can then email your comments to 39280 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#39280; Package emacs. (Sat, 25 Jan 2020 20:06:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tino Calancha <tino.calancha <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 25 Jan 2020 20:06:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.60; wdired-get-filename ignores first argument
Date: Sat, 25 Jan 2020 21:05:05 +0100
emacs -Q /tmp
M-! touch foo RET
g
j foo RET
C-x C-q
M-: (wdired-get-filename 'local t) RET
=> "/tmp/foo"
;; Expected: "foo"

--8<-----------------------------cut here---------------start------------->8---
commit 5f7e8975e741298718a4e05aa674873207cb56a6
Author: Tino Calancha <tino.calancha <at> gmail.com>
Date:   Sat Jan 25 21:03:53 2020 +0100

    Fix bug in wdired-get-filename
    
    * lisp/wdired.el (wdired-get-filename):
    Acknowledge the first argument.
    * test/lisp/wdired-tests.el (wdired-test-bug39280): Add test.

diff --git a/lisp/wdired.el b/lisp/wdired.el
index d470e0a21b..23dc4b9ef5 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -344,7 +344,7 @@ wdired-get-filename
 	;; Don't unquote the old name, it wasn't quoted in the first place
         (and file (setq file (wdired-normalize-filename file (not old)))))
       (if (or no-dir old)
-	  file
+	  (if no-dir (file-relative-name file) file)
 	(and file (> (length file) 0)
              (concat (dired-current-directory) file))))))
 
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index baa547758e..3d5f504205 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -176,6 +176,22 @@ wdired-test-bug34915
       (server-force-delete)
       (delete-directory test-dir t))))
 
+(ert-deftest wdired-test-bug39280 ()
+  "Test for https://debbugs.gnu.org/39280."
+  (let* ((test-dir (make-temp-file "test-dir" 'dir))
+         (fname "foo")
+         (full-fname (expand-file-name fname test-dir)))
+    (make-empty-file full-fname)
+    (let ((buf (find-file-noselect test-dir)))
+      (unwind-protect
+	  (with-current-buffer buf
+	    (dired-toggle-read-only)
+            (dolist (old '(t nil))
+              (should (equal fname (wdired-get-filename 'nodir old)))
+              (should (equal full-fname (wdired-get-filename nil old))))
+	    (wdired-finish-edit))
+	(if buf (kill-buffer buf))
+	(delete-directory test-dir t)))))
 
 (provide 'wdired-tests)
 ;;; wdired-tests.el ends here
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 27.0.60 (build 24, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2020-01-25 built on calancha-pc.dy.bbexcite.jp
Repository revision: baca81e64141aed076fe088e7160f6e0d4a51c68
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
(Shell command succeeded with no output)
Press C-c C-c when finished or C-c ESC to abort changes
"/tmp/foo"
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD PDUMPER
LCMS2 GMP





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39280; Package emacs. (Sat, 25 Jan 2020 20:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 39280 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 39280 <at> debbugs.gnu.org
Subject: Re: bug#39280: 27.0.60; wdired-get-filename ignores first argument
Date: Sat, 25 Jan 2020 21:55:25 +0100
On Sat, 25 Jan 2020 21:05:05 +0100 Tino Calancha <tino.calancha <at> gmail.com> wrote:

> emacs -Q /tmp
> M-! touch foo RET
> g
> j foo RET
> C-x C-q
> M-: (wdired-get-filename 'local t) RET
> => "/tmp/foo"
> ;; Expected: "foo"

Do you have a use case for this?  AFAICS in wdired.el there are no uses
of wdired-get-filename with both of its arguments non-nil.

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39280; Package emacs. (Sat, 25 Jan 2020 21:14:02 GMT) Full text and rfc822 format available.

Message #11 received at 39280 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 39280 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#39280: 27.0.60; wdired-get-filename ignores first argument
Date: Sat, 25 Jan 2020 22:13:10 +0100 (CET)

On Sat, 25 Jan 2020, Stephen Berman wrote:

> On Sat, 25 Jan 2020 21:05:05 +0100 Tino Calancha <tino.calancha <at> gmail.com> wrote:
>
>> emacs -Q /tmp
>> M-! touch foo RET
>> g
>> j foo RET
>> C-x C-q
>> M-: (wdired-get-filename 'local t) RET
>> => "/tmp/foo"
>> ;; Expected: "foo"
>
> Do you have a use case for this?
No, I don't have one.

> AFAICS in wdired.el there are no uses
> of wdired-get-filename with both of its arguments non-nil.

Right, that's why we haven't detected this bug before.
I was playing a bit with wdired this month, and when I tried
to call this function with both args non-nil I got unexpected results.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39280; Package emacs. (Sun, 26 Jan 2020 10:48:01 GMT) Full text and rfc822 format available.

Message #14 received at 39280 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 39280 <at> debbugs.gnu.org
Subject: Re: bug#39280: 27.0.60; wdired-get-filename ignores first argument
Date: Sun, 26 Jan 2020 11:47:06 +0100
On Sat, 25 Jan 2020 22:13:10 +0100 (CET) Tino Calancha <tino.calancha <at> gmail.com> wrote:

> On Sat, 25 Jan 2020, Stephen Berman wrote:
>
>> On Sat, 25 Jan 2020 21:05:05 +0100 Tino Calancha <tino.calancha <at> gmail.com> wrote:
>>
>>> emacs -Q /tmp
>>> M-! touch foo RET
>>> g
>>> j foo RET
>>> C-x C-q
>>> M-: (wdired-get-filename 'local t) RET
>>> => "/tmp/foo"
>>> ;; Expected: "foo"
>>
>> Do you have a use case for this?
> No, I don't have one.

I see you do now, as a possible fix for bug#39284.

>> AFAICS in wdired.el there are no uses
>> of wdired-get-filename with both of its arguments non-nil.
>
> Right, that's why we haven't detected this bug before.
> I was playing a bit with wdired this month, and when I tried
> to call this function with both args non-nil I got unexpected results.

Ok.

Steve Berman




Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sun, 23 Aug 2020 13:17:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39280; Package emacs. (Thu, 01 Oct 2020 21:27:02 GMT) Full text and rfc822 format available.

Message #19 received at 39280 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 39280 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#39280: 27.0.60; wdired-get-filename ignores first argument
Date: Thu, 01 Oct 2020 23:26:29 +0200
Stephen Berman <stephen.berman <at> gmx.net> writes:

>>> Do you have a use case for this?
>> No, I don't have one.
>
> I see you do now, as a possible fix for bug#39284.

Looks like this wasn't applied at the time, but if I read the patch
correctly, it looks like the right fix to me, so I've applied it to
Emacs 28 now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 01 Oct 2020 21:27:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 39280 <at> debbugs.gnu.org and Tino Calancha <tino.calancha <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 01 Oct 2020 21:27:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 30 Oct 2020 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 21 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.