From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#50189: wdired chmod should not follow symlinks Date: Tue, 24 Aug 2021 11:04:47 -0700 Organization: UCLA Computer Science Department Message-ID: <55e059fe-c2ae-e8cb-20e2-30de656ce0a7@cs.ucla.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1C8A237C3E2690677B35D53F" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5947"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 To: 50189@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 24 20:06:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIaoO-0001Fn-H3 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Aug 2021 20:06:12 +0200 Original-Received: from localhost ([::1]:53366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIaoN-0004XK-CN for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Aug 2021 14:06:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIaoE-0004Pw-Lx for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 14:06:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIaoE-0005Gx-Dq for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 14:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mIaoD-0004TR-RK for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 14:06:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Aug 2021 18:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50189 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Emacs bug reports and feature requests Original-Received: via spool by submit@debbugs.gnu.org id=B.162982830617121 (code B ref -1); Tue, 24 Aug 2021 18:06:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Aug 2021 18:05:06 +0000 Original-Received: from localhost ([127.0.0.1]:45157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIanH-0004Rw-1K for submit@debbugs.gnu.org; Tue, 24 Aug 2021 14:05:06 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:52994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIanB-0004RP-Le for submit@debbugs.gnu.org; Tue, 24 Aug 2021 14:05:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIanB-0001wb-GE for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 14:04:57 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42310) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIan9-0004DE-CT for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 14:04:57 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D093716005A for ; Tue, 24 Aug 2021 11:04:52 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id UZGGBHEJ0o4w for ; Tue, 24 Aug 2021 11:04:48 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2525B1600BB for ; Tue, 24 Aug 2021 11:04:48 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id P79XqSzyLB9c for ; Tue, 24 Aug 2021 11:04:48 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 0137416005A for ; Tue, 24 Aug 2021 11:04:47 -0700 (PDT) Content-Language: en-US Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:212565 Archived-At: This is a multi-part message in MIME format. --------------1C8A237C3E2690677B35D53F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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. --------------1C8A237C3E2690677B35D53F Content-Type: text/x-patch; charset=UTF-8; name="0001-Make-wdired-match-dired-with-symlink-permissions.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Make-wdired-match-dired-with-symlink-permissions.patch" >From 9b31a8ea5a919d67c6e78706b1b86ffbdf336e11 Mon Sep 17 00:00:00 2001 From: Paul Eggert 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 --------------1C8A237C3E2690677B35D53F--