GNU bug report logs - #50189
wdired chmod should not follow symlinks (Bug#11912 followup)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Paul Eggert <eggert@HIDDEN>; Keywords: patch; dated Tue, 24 Aug 2021 18:06:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 50189 <at> debbugs.gnu.org:


Received: (at 50189) by debbugs.gnu.org; 25 Aug 2021 11:47:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 25 07:47:49 2021
Received: from localhost ([127.0.0.1]:45961 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mIrNg-00055R-O3
	for submit <at> debbugs.gnu.org; Wed, 25 Aug 2021 07:47:49 -0400
Received: from quimby.gnus.org ([95.216.78.240]:35626)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mIrNb-0004x7-9T
 for 50189 <at> debbugs.gnu.org; Wed, 25 Aug 2021 07:47:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=i+d7SbwYHpmyHHzpv8QLDnBR8kaN4BufF24cMb3VFHY=; b=c8glxjJp21zX5ie4jL5MpCHxSR
 IqDBl722lJIx5P1D4HdZuxD/IYKpOrT2dHvYjrJhHDaRcGR6QYPc5UGS8kiFuuuVmUTlWoknBBLQV
 NpiLS84gCDgZaraU5YFklfRW78V7K2V+Kaj/7B0EgmqgeBeW5PgyQ4M3QcSWGZ4HIY+w=;
Received: from [84.212.220.105] (helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mIrNQ-0003i2-Cf; Wed, 25 Aug 2021 13:47:32 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
Subject: Re: bug#50189: wdired chmod should not follow symlinks (Bug#11912
 followup)
References: <55e059fe-c2ae-e8cb-20e2-30de656ce0a7@HIDDEN>
Date: Wed, 25 Aug 2021 13:47:27 +0200
In-Reply-To: <55e059fe-c2ae-e8cb-20e2-30de656ce0a7@HIDDEN> (Paul Eggert's
 message of "Tue, 24 Aug 2021 11:04:47 -0700")
Message-ID: <87pmu1kapc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Paul Eggert <eggert@HIDDEN> writes: > 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. Yeah, editing the permissions doesn't seem
 to work for me in dired. If I start with 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50189
Cc: 50189 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Paul Eggert <eggert@HIDDEN> writes:

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

Yeah, editing the permissions doesn't seem to work for me in dired.  If
I start with

  -rw-r--r--  1 larsi      larsi       329K Aug 21 18:22 IMG_4478.JPG

and press DEL after the final dash, it'll delete the dash and then say
"Text is read only", leaving me with:

  -rw-r--r-  1 larsi      larsi       329K Aug 21 18:22 IMG_4478.JPG

And then I can't insert anything there, because it's now read-only.  So
something is wonky in the way wdired tries to make certain bits of the
line read-only.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50189; Package emacs. Full text available.
Changed bug title to 'wdired chmod should not follow symlinks (Bug#11912 followup)' from 'wdired chmod should not follow symlinks' Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) patch. Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 Aug 2021 18:05:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 24 14:05:06 2021
Received: from localhost ([127.0.0.1]:45157 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mIanH-0004Rw-1K
	for submit <at> debbugs.gnu.org; Tue, 24 Aug 2021 14:05:06 -0400
Received: from lists.gnu.org ([209.51.188.17]:52994)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1mIanB-0004RP-Le
 for submit <at> debbugs.gnu.org; Tue, 24 Aug 2021 14:05:01 -0400
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 <eggert@HIDDEN>)
 id 1mIanB-0001wb-GE
 for bug-gnu-emacs@HIDDEN; Tue, 24 Aug 2021 14:04:57 -0400
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 <eggert@HIDDEN>)
 id 1mIan9-0004DE-CT
 for bug-gnu-emacs@HIDDEN; Tue, 24 Aug 2021 14:04:57 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id D093716005A
 for <bug-gnu-emacs@HIDDEN>; Tue, 24 Aug 2021 11:04:52 -0700 (PDT)
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 <bug-gnu-emacs@HIDDEN>;
 Tue, 24 Aug 2021 11:04:48 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2525B1600BB
 for <bug-gnu-emacs@HIDDEN>; Tue, 24 Aug 2021 11:04:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
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 <bug-gnu-emacs@HIDDEN>;
 Tue, 24 Aug 2021 11:04:48 -0700 (PDT)
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 <bug-gnu-emacs@HIDDEN>; Tue, 24 Aug 2021 11:04:47 -0700 (PDT)
To: Emacs bug reports and feature requests <bug-gnu-emacs@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Subject: wdired chmod should not follow symlinks
Organization: UCLA Computer Science Department
Message-ID: <55e059fe-c2ae-e8cb-20e2-30de656ce0a7@HIDDEN>
Date: Tue, 24 Aug 2021 11:04:47 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.11.0
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1C8A237C3E2690677B35D53F"
Content-Language: en-US
Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@HIDDEN;
 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-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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 <eggert@HIDDEN>
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--




Acknowledgement sent to Paul Eggert <eggert@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#50189; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 25 Aug 2021 12:00:02 UTC

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