GNU bug report logs - #39284
27.0.60; wdired: change file permissions fails on tramp buffers

Previous Next

Package: emacs;

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

Date: Sat, 25 Jan 2020 21:46: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 39284 in the body.
You can then email your comments to 39284 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#39284; Package emacs. (Sat, 25 Jan 2020 21:46: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 21:46: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: change file permissions fails on tramp buffers
Date: Sat, 25 Jan 2020 22:45:30 +0100
emacs -Q /tmp -l wdired --eval '(setq wdired-allow-to-change-permissions t)'
M-! touch foo RET
g
;; re-visit Dired buffer as root
C-x d /sudo::/tmp RET
j foo RET
C-x C-q
;; change the permissions for foo
C-a C-f C-f C-f SPC
C-c C-c
;; It fails because it passes the wrong argument to the external chmod.


I propose 2 alternatives patches:

1) Assuming Bug#39280 is fixed, we just need to change 1 line ...:

--8<-----------------------------cut here---------------start------------->8---
commit 6c139e1582645d210f051e547609b524ef6d1ef6
Author: Tino Calancha <tino.calancha <at> gmail.com>
Date:   Sat Jan 25 19:53:20 2020 +0100

    Fix bug 39284
    
    * lisp/wdired.el (wdired-do-perm-changes)
    Call wdired-get-filename with non-nil.

diff --git a/lisp/wdired.el b/lisp/wdired.el
index 23dc4b9ef5..81071d40be 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -894,7 +894,7 @@ wdired-do-perm-changes
 		       (point) (next-single-property-change (point) 'end-perm)))
       (unless (equal perms-ori perms-new)
         (setq changes t)
-        (setq filename (wdired-get-filename nil t))
+        (setq filename (wdired-get-filename 'no-dir t))
         (if (= (length perms-new) 10)
             (progn
               (setq perm-tmp
--8<-----------------------------cut here---------------end--------------->8---

2) ... Or replace the call to the external chmod with built-in `set-file-modes'
(this is what `dired-do-chmod' does):

--8<-----------------------------cut here---------------start------------->8---
commit b2e6fc288e55919d54e27d24e478f7815d406514
Author: Tino Calancha <tino.calancha <at> gmail.com>
Date:   Sat Jan 25 22:27:08 2020 +0100

    Fix bug 39284
    
    * lisp/wdired.el (wdired-do-perm-changes)
    Use set-file-modes instead of external program.

diff --git a/lisp/wdired.el b/lisp/wdired.el
index d470e0a21b..34aa61f9ae 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -898,9 +898,8 @@ wdired-do-perm-changes
         (if (= (length perms-new) 10)
             (progn
               (setq perm-tmp
-                    (int-to-string (wdired-perms-to-number perms-new)))
-              (unless (equal 0 (process-file dired-chmod-program
-					     nil nil nil perm-tmp filename))
+                    (string-to-number (int-to-string (wdired-perms-to-number perms-new)) 8))
+              (unless (set-file-modes filename perm-tmp)
                 (setq errors (1+ errors))
                 (dired-log "%s %s `%s' failed\n\n"
                            dired-chmod-program perm-tmp filename)))

--8<-----------------------------cut here---------------end--------------->8---



In GNU Emacs 27.0.60 (build 28, 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:
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘calancha-pc.dy.bbexcite.jp’
Tramp: Opening connection for root <at> calancha-pc.dy.bbexcite.jp using sudo...done
Directory has changed on disk; type g to update Dired
Mark set
Press C-c C-c when finished or C-c ESC to abort changes
C-c C-f is undefined
1 rename actions failed--type ? for details
d-elete, u-ndelete, x-punge, f-ind, o-ther window, R-ename, C-opy, h-elp
Tramp: Timeout session /sudo:root <at> calancha-pc.dy.bbexcite.jp:





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39284; Package emacs. (Tue, 11 Feb 2020 09:04:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 39284 <at> debbugs.gnu.org
Subject: Re: bug#39284: 27.0.60; wdired: change file permissions fails on
 tramp buffers
Date: Tue, 11 Feb 2020 10:03:11 +0100
Tino Calancha <tino.calancha <at> gmail.com> writes:

Hi Tino,

> 1) Assuming Bug#39280 is fixed, we just need to change 1 line ...:
>
> 2) ... Or replace the call to the external chmod with built-in `set-file-modes'
> (this is what `dired-do-chmod' does):

I recommend alternative 2. Tramp has different implementations of
`set-file-modes', and not all of them are based on the "chmod" command.

Best regards, Michael.




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#39284; Package emacs. (Thu, 01 Oct 2020 21:37:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 39284 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#39284: 27.0.60; wdired: change file permissions fails on
 tramp buffers
Date: Thu, 01 Oct 2020 23:35:51 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

>> 1) Assuming Bug#39280 is fixed, we just need to change 1 line ...:
>>
>> 2) ... Or replace the call to the external chmod with built-in
>> `set-file-modes'
>> (this is what `dired-do-chmod' does):
>
> I recommend alternative 2. Tramp has different implementations of
> `set-file-modes', and not all of them are based on the "chmod" command.

This wasn't applied at the time, so I did that now.  This was a bit odd,
though:

+                    (string-to-number (int-to-string (wdired-perms-to-number perms-new)) 8))

-- 
(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:37:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 39284 <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:37: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:13 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 179 days ago.

Previous Next


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