unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50189: wdired chmod should not follow symlinks
@ 2021-08-24 18:04 Paul Eggert
  2021-08-25 11:47 ` bug#50189: wdired chmod should not follow symlinks (Bug#11912 followup) Lars Ingebrigtsen
  2022-09-10  6:21 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: Paul Eggert @ 2021-08-24 18:04 UTC (permalink / raw)
  To: 50189

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

To be consistent with dired M, wdired's method of textually editing a 
symlink's permissions should also not follow symlinks. Proposed patch 
attached.

I did not test this, as I don't use wdired and couldn't get it to work 
for me regardless of whether the patch is applied.

This patch also removes some obsolete commentary about dired-chmod-program.

[-- Attachment #2: 0001-Make-wdired-match-dired-with-symlink-permissions.patch --]
[-- Type: text/x-patch, Size: 2071 bytes --]

From 9b31a8ea5a919d67c6e78706b1b86ffbdf336e11 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 24 Aug 2021 11:00:52 -0700
Subject: [PATCH] Make wdired match dired with symlink permissions

* lisp/wdired.el (wdired-do-perm-changes): Do not follow symlinks,
to be consistent with plain dired.
---
 lisp/wdired.el | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/lisp/wdired.el b/lisp/wdired.el
index fd549bac32..70dfd2c80a 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -45,8 +45,7 @@
 ;;
 ;; - Change the target of symbolic links.
 ;;
-;; - Change the permission bits of the filenames (in systems with a
-;;   working unix-alike `dired-chmod-program').  See and customize the
+;; - Change the permission bits of the filenames.  See and customize the
 ;;   variable `wdired-allow-to-change-permissions'.  To change a single
 ;;   char (toggling between its two more usual values) you can press
 ;;   the space bar over it or left-click the mouse.  To set any char to
@@ -125,10 +124,7 @@ wdired-allow-to-change-permissions
 If `advanced', the bits are freely editable.  You can use
 `string-rectangle', `query-replace', etc.  You can put any value (even
 newlines), but if you want your changes to be useful, you better put a
-intelligible value.
-
-Anyway, the real change of the permissions is done by the external
-program `dired-chmod-program', which must exist."
+intelligible value."
   :type '(choice (const :tag "Not allowed" nil)
                  (const :tag "Toggle/set bits" t)
 		 (other :tag "Bits freely editable" advanced)))
@@ -995,7 +991,8 @@ wdired-do-perm-changes
         (setq filename (wdired-get-filename nil t))
         (if (= (length perms-new) 10)
             (condition-case nil
-                (set-file-modes filename (wdired-perms-to-number perms-new))
+		(set-file-modes filename (wdired-perms-to-number perms-new)
+				'nofollow)
               (error
                (setq errors (1+ errors))
                (dired-log "Setting mode of `%s' to `%s' failed\n\n"
-- 
2.31.1


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

end of thread, other threads:[~2022-09-11 11:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 18:04 bug#50189: wdired chmod should not follow symlinks Paul Eggert
2021-08-25 11:47 ` bug#50189: wdired chmod should not follow symlinks (Bug#11912 followup) Lars Ingebrigtsen
2022-09-10  6:28   ` Lars Ingebrigtsen
2022-09-11  1:32     ` Michael Heerdegen
2022-09-11 11:05       ` Lars Ingebrigtsen
2022-09-10  6:21 ` 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).