unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39284: 27.0.60; wdired: change file permissions fails on tramp buffers
@ 2020-01-25 21:45 Tino Calancha
  2020-02-11  9:03 ` Michael Albinus
  0 siblings, 1 reply; 3+ messages in thread
From: Tino Calancha @ 2020-01-25 21:45 UTC (permalink / raw)
  To: 39284


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:






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

* bug#39284: 27.0.60; wdired: change file permissions fails on tramp buffers
  2020-01-25 21:45 bug#39284: 27.0.60; wdired: change file permissions fails on tramp buffers Tino Calancha
@ 2020-02-11  9:03 ` Michael Albinus
  2020-10-01 21:35   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Albinus @ 2020-02-11  9:03 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 39284

Tino Calancha <tino.calancha@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.





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

* bug#39284: 27.0.60; wdired: change file permissions fails on tramp buffers
  2020-02-11  9:03 ` Michael Albinus
@ 2020-10-01 21:35   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-01 21:35 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 39284, Tino Calancha

Michael Albinus <michael.albinus@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





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

end of thread, other threads:[~2020-10-01 21:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-25 21:45 bug#39284: 27.0.60; wdired: change file permissions fails on tramp buffers Tino Calancha
2020-02-11  9:03 ` Michael Albinus
2020-10-01 21:35   ` Lars Ingebrigtsen

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).