unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: 39284@debbugs.gnu.org
Subject: bug#39284: 27.0.60; wdired: change file permissions fails on tramp buffers
Date: Sat, 25 Jan 2020 22:45:30 +0100	[thread overview]
Message-ID: <87imkzp5vp.fsf@calancha-pc.dy.bbexcite.jp> (raw)


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@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@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@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@calancha-pc.dy.bbexcite.jp:






             reply	other threads:[~2020-01-25 21:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-25 21:45 Tino Calancha [this message]
2020-02-11  9:03 ` bug#39284: 27.0.60; wdired: change file permissions fails on tramp buffers Michael Albinus
2020-10-01 21:35   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imkzp5vp.fsf@calancha-pc.dy.bbexcite.jp \
    --to=tino.calancha@gmail.com \
    --cc=39284@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).