From unknown Wed Sep 10 10:35:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28264: Accessing source directory through symlink produces false warnings Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: eggert@cs.ucla.edu, bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Aug 2017 18:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28264 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 28264@debbugs.gnu.org Cc: Paul Eggert X-Debbugs-Original-To: submit@debbugs.gnu.org X-Debbugs-Original-Xcc: Paul Eggert Received: via spool by submit@debbugs.gnu.org id=B.150394472919156 (code B ref -1); Mon, 28 Aug 2017 18:26:01 +0000 Received: (at submit) by debbugs.gnu.org; 28 Aug 2017 18:25:29 +0000 Received: from localhost ([127.0.0.1]:59644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmOj3-0004yu-8x for submit@debbugs.gnu.org; Mon, 28 Aug 2017 14:25:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51485) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmOj1-0004yh-PK for submit@debbugs.gnu.org; Mon, 28 Aug 2017 14:25:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmOiv-0005LI-LN for submit@debbugs.gnu.org; Mon, 28 Aug 2017 14:25:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmOiv-0005L6-Hg for submit@debbugs.gnu.org; Mon, 28 Aug 2017 14:25:21 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1dmOiv-0001Eu-3o; Mon, 28 Aug 2017 14:25:21 -0400 From: Glenn Morris X-Spook: Reno Ruby Ridge SHA Clinton pink noise Hostage Al Jazeera X-Ran: ",&jWH|G#y4LxI!baW+1Qzhn]Hkl+mNtNFvIb9]ZX-/Cw%^!~-+k4P\0cfW!H:P:<]U`aq X-Hue: magenta X-Attribution: GM Date: Mon, 28 Aug 2017 14:25:20 -0400 Message-ID: <8fo9qzeei7.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Package: emacs Version: 26.0.50 Current master (cd0360f) on rhel7. Emacs sources are in (eg) /tmp/emacs/git/master cd ~ ln -s /tmp/emacs/git/master ~/master/src/emacs -Q This results in the following new, spurious warnings: Warning: arch-dependent data dir '/:/tmp/emacs/git/master/lib-src/': No such file or directory Warning: Lisp directory '/:/tmp/emacs/git/master/lisp': No such file or directory I would suspect recent changes to file name / symlink handling. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 28 14:27:02 2017 Received: (at control) by debbugs.gnu.org; 28 Aug 2017 18:27:03 +0000 Received: from localhost ([127.0.0.1]:59649 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmOkY-00051i-Kj for submit@debbugs.gnu.org; Mon, 28 Aug 2017 14:27:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51898) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmOkX-00051F-MW for control@debbugs.gnu.org; Mon, 28 Aug 2017 14:27:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmOkS-0007KL-2M for control@debbugs.gnu.org; Mon, 28 Aug 2017 14:26:56 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmOkR-0007KH-Vq for control@debbugs.gnu.org; Mon, 28 Aug 2017 14:26:56 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1dmOkR-0001Y8-Nh for control@debbugs.gnu.org; Mon, 28 Aug 2017 14:26:55 -0400 Subject: control message for bug 24655 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Mon, 28 Aug 2017 14:26:55 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) block 24655 by 28264 From unknown Wed Sep 10 10:35:59 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Glenn Morris Subject: bug#28264: closed (Re: bug#28264: Accessing source directory through symlink produces false warnings) Message-ID: References: <6cd94296-2dd5-ac88-185b-ed7d5d8e5533@cs.ucla.edu> <8fo9qzeei7.fsf@fencepost.gnu.org> X-Gnu-PR-Message: they-closed 28264 X-Gnu-PR-Package: emacs Reply-To: 28264@debbugs.gnu.org Date: Tue, 29 Aug 2017 04:58:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1503982682-32217-1" This is a multi-part message in MIME format... ------------=_1503982682-32217-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #28264: Accessing source directory through symlink produces false warnings which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 28264@debbugs.gnu.org. --=20 28264: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D28264 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1503982682-32217-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 28264-done) by debbugs.gnu.org; 29 Aug 2017 04:57:35 +0000 Received: from localhost ([127.0.0.1]:59919 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmYal-0008N1-5I for submit@debbugs.gnu.org; Tue, 29 Aug 2017 00:57:35 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmYai-0008Mn-OY for 28264-done@debbugs.gnu.org; Tue, 29 Aug 2017 00:57:33 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 93A06160910; Mon, 28 Aug 2017 21:57:25 -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 HdPtHcKFFHlI; Mon, 28 Aug 2017 21:57:24 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B281D160952; Mon, 28 Aug 2017 21:57:24 -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 RceAs2N-RFN6; Mon, 28 Aug 2017 21:57:24 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.153.184.153]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 89E4C1608E8; Mon, 28 Aug 2017 21:57:24 -0700 (PDT) Subject: Re: bug#28264: Accessing source directory through symlink produces false warnings To: Glenn Morris , 28264-done@debbugs.gnu.org References: <8fo9qzeei7.fsf@fencepost.gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <6cd94296-2dd5-ac88-185b-ed7d5d8e5533@cs.ucla.edu> Date: Mon, 28 Aug 2017 21:57:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <8fo9qzeei7.fsf@fencepost.gnu.org> Content-Type: multipart/mixed; boundary="------------E3463A97300559C7E452761B" Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 28264-done Cc: Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --------------E3463A97300559C7E452761B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Thanks for the bug report. I reproduced the problem and installed the attached patch to fix it. It strikes me, though, that the code still won't work in other cases (e.g., symlinks containing ":"), and that Emacs probably has other instances of confusion between how it treats symlinks and how the OS treats them. I'll CC: this to Michael to give him a heads-up about this particular issue, as I'm not really up to speed on magic file names. --------------E3463A97300559C7E452761B Content-Type: text/x-patch; name="0001-Silence-false-alarms-for-symlinks-to-sources.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Silence-false-alarms-for-symlinks-to-sources.patch" >From c1854b1d31e1b0a3a9e91ef41110a5fa77bedb31 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 28 Aug 2017 21:50:09 -0700 Subject: [PATCH] Silence false alarms for symlinks to sources Problem reported by Glenn Morris (Bug#28264). * lisp/files.el (files--splice-dirname-file): New function. (file-truename, file-chase-links): Use it. --- lisp/files.el | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index b3eab29..5f55aa7 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1153,6 +1153,21 @@ files--name-absolute-system-p (and (file-name-absolute-p file) (not (eq (aref file 0) ?~)))) +(defun files--splice-dirname-file (dirname file) + "Splice DIRNAME to FILE like the operating system would. +If FILENAME is relative, return DIRNAME concatenated to FILE. +Otherwise return FILE, quoted with `/:' if DIRNAME and FILE have +different handlers; although this quoting is dubious if DIRNAME +is remote, it is not clear what would be better. This function +differs from `expand-file-name' in that DIRNAME must be a +directory name and leading `~' and `/:' are not special in FILE." + (if (files--name-absolute-system-p file) + (if (eq (find-file-name-handler dirname 'file-symlink-p) + (find-file-name-handler file 'file-symlink-p)) + file + (concat "/:" file)) + (concat dirname file))) + (defun file-truename (filename &optional counter prev-dirs) "Return the truename of FILENAME. If FILENAME is not absolute, first expands it against `default-directory'. @@ -1253,10 +1268,7 @@ file-truename ;; We can't safely use expand-file-name here ;; since target might look like foo/../bar where foo ;; is itself a link. Instead, we handle . and .. above. - (setq filename - (concat (if (files--name-absolute-system-p target) - "/:" dir) - target) + (setq filename (files--splice-dirname-file dir target) done nil) ;; No, we are done! (setq done t)))))))) @@ -1291,10 +1303,8 @@ file-chase-links (directory-file-name (file-name-directory newname)))) ;; Now find the parent of that dir. (setq newname (file-name-directory newname))) - (setq newname (concat (if (files--name-absolute-system-p tem) - "/:" - (file-name-directory newname)) - tem)) + (setq newname (files--splice-dirname-file (file-name-directory newname) + tem)) (setq count (1+ count)))) newname)) -- 2.7.4 --------------E3463A97300559C7E452761B-- ------------=_1503982682-32217-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 28 Aug 2017 18:25:29 +0000 Received: from localhost ([127.0.0.1]:59644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmOj3-0004yu-8x for submit@debbugs.gnu.org; Mon, 28 Aug 2017 14:25:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51485) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmOj1-0004yh-PK for submit@debbugs.gnu.org; Mon, 28 Aug 2017 14:25:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmOiv-0005LI-LN for submit@debbugs.gnu.org; Mon, 28 Aug 2017 14:25:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmOiv-0005L6-Hg for submit@debbugs.gnu.org; Mon, 28 Aug 2017 14:25:21 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1dmOiv-0001Eu-3o; Mon, 28 Aug 2017 14:25:21 -0400 From: Glenn Morris To: submit@debbugs.gnu.org Subject: Accessing source directory through symlink produces false warnings X-Debbugs-CC: Paul Eggert X-Spook: Reno Ruby Ridge SHA Clinton pink noise Hostage Al Jazeera X-Ran: ",&jWH|G#y4LxI!baW+1Qzhn]Hkl+mNtNFvIb9]ZX-/Cw%^!~-+k4P\0cfW!H:P:<]U`aq X-Hue: magenta X-Debbugs-No-Ack: yes X-Attribution: GM Date: Mon, 28 Aug 2017 14:25:20 -0400 Message-ID: <8fo9qzeei7.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Package: emacs Version: 26.0.50 Current master (cd0360f) on rhel7. Emacs sources are in (eg) /tmp/emacs/git/master cd ~ ln -s /tmp/emacs/git/master ~/master/src/emacs -Q This results in the following new, spurious warnings: Warning: arch-dependent data dir '/:/tmp/emacs/git/master/lib-src/': No such file or directory Warning: Lisp directory '/:/tmp/emacs/git/master/lisp': No such file or directory I would suspect recent changes to file name / symlink handling. ------------=_1503982682-32217-1-- From unknown Wed Sep 10 10:35:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28264: Accessing source directory through symlink produces false warnings Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Aug 2017 20:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28264 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: Glenn Morris , 28264@debbugs.gnu.org Received: via spool by 28264-submit@debbugs.gnu.org id=B28264.150403933216021 (code B ref 28264); Tue, 29 Aug 2017 20:43:02 +0000 Received: (at 28264) by debbugs.gnu.org; 29 Aug 2017 20:42:12 +0000 Received: from localhost ([127.0.0.1]:32933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmnKt-0004AK-Pa for submit@debbugs.gnu.org; Tue, 29 Aug 2017 16:42:11 -0400 Received: from mout.gmx.net ([212.227.17.20]:53593) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmnKr-0004A6-PN for 28264@debbugs.gnu.org; Tue, 29 Aug 2017 16:42:10 -0400 Received: from detlef.gmx.de ([79.140.121.193]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MZwYd-1e5iKU3Jfj-00LkY8; Tue, 29 Aug 2017 22:41:53 +0200 From: Michael Albinus References: <8fo9qzeei7.fsf@fencepost.gnu.org> <6cd94296-2dd5-ac88-185b-ed7d5d8e5533@cs.ucla.edu> Date: Tue, 29 Aug 2017 22:41:51 +0200 In-Reply-To: <6cd94296-2dd5-ac88-185b-ed7d5d8e5533@cs.ucla.edu> (Paul Eggert's message of "Mon, 28 Aug 2017 21:57:15 -0700") Message-ID: <87378a9kds.fsf@detlef> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:JHBddE6/D0z0xMk6IhohhXdZ1Oovc4P6nAghTqpQxzEB7esyELI H4N/jGAyzeKncNiXR7B/1AyHGMCEz8CxTxgN2ZZw/BgrqntVoLsHdtXwPeikX4TKybJNUJd h9XhPjcURHHdWmcvqhFMZGdv9OK+Aq7EbDeo/MqRzXCuMpQr1rEF7X12+9gOGvpB4JRedxn YhfKl3I4TaN+aNPwAsKcQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:YwyPr2UP6ro=:7+RyTKc/gy1kuSG7m1Gxtu qU4aGzA8tBpTY49ZU3Wq80abmLkCEFFJ8t98F3syVRSru+i6SWEd4yyAg5cIgJT1W2RowqWR9 1TWtyX2MA+Wz5eimQC+YvFTFDpGDsij88iz3Q3Kwco/oLQCibb6sBttC9to8vHwc+T6mOpD0V 1clklzUwfoh/5cULi02sDq5SzOGrMIURejONR9q7iDq7tn7cDBWAHVEEfno67uJQ34NhQ7bLo zDJNDm+ZtmmcmOwAGUlZg2i/9YbyqNS8IY8EA2pl1Gg8fD1db61KfpUdugMZPr1NIMG4MuWvv tUnCT0C23SlLdrVFHYSWxEt/IQagQl+fAkbMZ/gZUKI+zIduIZ6puafysEMy0eDxr5o+xDIei RL9JOmDT+0a4/ZqLWpPK/jVaQIF0aM8RYFXknXhM7Tp84iaNtWMIaK4Pd3kx8+BGf1Fp9W7wq vgkSWPy3Ke0iyOQz0bNQM0Nu6kQG3jLm6n21BSgw/bE6daei9pIxXQxlpIMPZrxOdQy0bReTa dwq6eRBgRjWH9eOXbL3Nh6prUJ3iKOFWWqvR8L4KvXHuHth+YM6dKWmtZx6ROyFN+9JMHtJeq Nm8WHIKk7VG3k7G162sjhxUPeKzFzMioAcqmvECyGdDYo64trojUX4yCg2hBvOl++Ddl4R7Gn ECFrimmT75BFXy4WSQVX3TSkG9MxVv6FdH97xWr+1LWJAygN1d9iDtvbHPUafY21mahFagEIP wRz6Rc8XSmkAfg6r9m2UUJp9SNaj6AZRH6+6eY0ce/ldJMURbyztA2Q65w6epF0OdG95totZA 6Wq/S4/WTmcrfSf1KFBjUbdVUBrWipU4UsZqBF492tADxu3Wto= X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Paul Eggert writes: Hi Paul, > Thanks for the bug report. I reproduced the problem and installed the > attached patch to fix it. It strikes me, though, that the code still > won't work in other cases (e.g., symlinks containing ":"), and that > Emacs probably has other instances of confusion between how it treats > symlinks and how the OS treats them. I'll CC: this to Michael to give > him a heads-up about this particular issue, as I'm not really up to > speed on magic file names. This special problem does not seem to affect Tramp, tramp-tests tell. However, the following code is unclear to me: > + (concat "/:" file)) What, if file is already quoted? Shouldn't this be (file-name-quote file) Note, that a similar problem I have fixed some days ago in commit cc7530cae0. Best regards, Michael. From unknown Wed Sep 10 10:35:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28264: Accessing source directory through symlink produces false warnings Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Aug 2017 02:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28264 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Albinus Cc: Glenn Morris , 28264@debbugs.gnu.org Received: via spool by 28264-submit@debbugs.gnu.org id=B28264.150405966413884 (code B ref 28264); Wed, 30 Aug 2017 02:22:01 +0000 Received: (at 28264) by debbugs.gnu.org; 30 Aug 2017 02:21:04 +0000 Received: from localhost ([127.0.0.1]:33050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmscq-0003bs-EU for submit@debbugs.gnu.org; Tue, 29 Aug 2017 22:21:04 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:36260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmsco-0003b3-5f for 28264@debbugs.gnu.org; Tue, 29 Aug 2017 22:21:02 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6FD51160951; Tue, 29 Aug 2017 19:20:56 -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 nMY19dnvaq7S; Tue, 29 Aug 2017 19:20:55 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 66CF6160910; Tue, 29 Aug 2017 19:20:55 -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 WYPHxrl7qpcs; Tue, 29 Aug 2017 19:20:55 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.153.184.153]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 40E9016090B; Tue, 29 Aug 2017 19:20:55 -0700 (PDT) References: <8fo9qzeei7.fsf@fencepost.gnu.org> <6cd94296-2dd5-ac88-185b-ed7d5d8e5533@cs.ucla.edu> <87378a9kds.fsf@detlef> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Tue, 29 Aug 2017 19:20:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <87378a9kds.fsf@detlef> Content-Type: multipart/mixed; boundary="------------197FD0636636139FD347ABB3" Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --------------197FD0636636139FD347ABB3 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Michael Albinus wrote: > This special problem does not seem to affect Tramp, tramp-tests tell. The problem I was thinking of does not seem to be covered by Tramp tests.= If,=20 for example, I do these shell commands: $ ln -s "../penguin:motd" /tmp/foo $ ls -l /tmp/foo lrwxrwxrwx 1 eggert eggert 15 Aug 29 19:00 /tmp/foo -> ../penguin:motd then (file-truename "/tmp/foo") returns "/penguin:motd" which is not /tmp= /foo's=20 true name as far as Emacs file-oriented commands are concerned. Admittedl= y this=20 is an improvement over Emacs 25.2 where the same file-truename call ssh'e= s into=20 penguin to resolve the name, which is a clear security issue. Still, it d= oesn't=20 seem right, if file-truename is expected to quote its result if necessary= . Sorry about all this confusion, but I do not know the general principle t= hat=20 Emacs is supposed to be using with file names, and to some extent I fear = that=20 there isn't one alas. > However, the following code is unclear to me: >=20 >> + (concat "/:" file)) >=20 > What, if file is already quoted? Shouldn't this be >=20 > (file-name-quote file) Quite possibly, and I'll take your word for it. I installed the attached. --------------197FD0636636139FD347ABB3 Content-Type: text/x-patch; name="0001-Prefer-file-name-quote-to-concat.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Prefer-file-name-quote-to-concat.patch" =46rom 0eb9f21ded1b6aefcf0ac33f393b07ab6a543a05 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 29 Aug 2017 19:17:54 -0700 Subject: [PATCH] Prefer file-name-quote to concat "/:" Suggested by Michael Albinus (Bug#28264#13). * lisp/files.el (files--splice-dirname-file): Use file-name-quote rather than attempting to do it by hand. --- lisp/files.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 5f55aa7..7754be2 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1156,16 +1156,16 @@ files--name-absolute-system-p (defun files--splice-dirname-file (dirname file) "Splice DIRNAME to FILE like the operating system would. If FILENAME is relative, return DIRNAME concatenated to FILE. -Otherwise return FILE, quoted with `/:' if DIRNAME and FILE have +Otherwise return FILE, quoted as needed if DIRNAME and FILE have different handlers; although this quoting is dubious if DIRNAME -is remote, it is not clear what would be better. This function +is magic, it is not clear what would be better. This function differs from `expand-file-name' in that DIRNAME must be a directory name and leading `~' and `/:' are not special in FILE." (if (files--name-absolute-system-p file) (if (eq (find-file-name-handler dirname 'file-symlink-p) (find-file-name-handler file 'file-symlink-p)) file - (concat "/:" file)) + (file-name-quote file)) (concat dirname file))) =20 (defun file-truename (filename &optional counter prev-dirs) --=20 2.7.4 --------------197FD0636636139FD347ABB3-- From unknown Wed Sep 10 10:35:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28264: Accessing source directory through symlink produces false warnings In-Reply-To: <8fo9qzeei7.fsf@fencepost.gnu.org> Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Aug 2017 08:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28264 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: Glenn Morris , 28264@debbugs.gnu.org Received: via spool by 28264-submit@debbugs.gnu.org id=B28264.150408224016501 (code B ref 28264); Wed, 30 Aug 2017 08:38:01 +0000 Received: (at 28264) by debbugs.gnu.org; 30 Aug 2017 08:37:20 +0000 Received: from localhost ([127.0.0.1]:33261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmyUx-0004I4-Oc for submit@debbugs.gnu.org; Wed, 30 Aug 2017 04:37:19 -0400 Received: from mout.gmx.net ([212.227.17.20]:57768) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmyUw-0004Hq-8L for 28264@debbugs.gnu.org; Wed, 30 Aug 2017 04:37:18 -0400 Received: from detlef.gmx.de ([212.86.61.201]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0Lm7MT-1dEBm62H1F-00ZgTY; Wed, 30 Aug 2017 10:37:07 +0200 From: Michael Albinus References: <8fo9qzeei7.fsf@fencepost.gnu.org> <6cd94296-2dd5-ac88-185b-ed7d5d8e5533@cs.ucla.edu> <87378a9kds.fsf@detlef> Date: Wed, 30 Aug 2017 10:37:05 +0200 Message-ID: <87fuc9e9ji.fsf@detlef> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:6tTNlMNdBP1QUeUaiasmsaBG4A2FqzwCZ1fdhgZ/ndGh2Tahrzr JeSHY03HPI5lhu/6PTopFvKpDstzzElRZQRHxHazZqsEA7sKE9egszX7eC2Fhv3cxycdjLa iERBHwtcNTCpVaWSH59/d0b0fGphkun0X1pWyvbAYEHTScNqkpTXZxeU/3ScsERt8Ui42Cw x7si/LunZP6ssoPkuu/6g== X-UI-Out-Filterresults: notjunk:1;V01:K0:ljbbMYfexl8=:ZHXBgr35PUcs1JsKLW0a1d FRENOM6MKXPDDCjoXoFikKnbiiYTLsVLz5Cfmw4YCn2wx4GIYjYB/jFeZFYqC6JDIE0Z+2dyt 7nCzgVNvFMfpG+Chjj3CQfe44fVQoNvoVVhHZpTNGj8OcLecCwbX1Wgte8P66sPhbmdz7yulC MOI+gCNH8QQGUp2NJ+DrFaPUJDNFImnLTyosOi1mn+2ZNm50TnQPh1hJ2YJjJPMthUXtbYMZR ezk9snxnJqtN63vgY6uG88WD4PHizAaozark8Cp9y9wauBptXYYY57Vo2iVdP+9Xz74SiRRVD s67eFj2nbx66qiqx05vJMhlEz01plDyM7WUNLAGMKzGyiRzX1tN/2F/hyeaYqXQHQ0wfA2NTG u9iKBTzsmEimnWmtef+gQpOiIy7+qWBlkOlvyoWkKerSFd6qC/Ejxiu0rgNZviaTZpjoIhHsp k5LFmQGNGvLD5v/hxNoMmsX2dkBTuzIsklWRZ+QYbzyyfwNu7iwTFnGJqM26ja4E2l4oN0NGT TPwHP5l4TiFuFpUHPUzyjuggfC2OtXDhZ6Lz1lMMOkbgoW6ffDtd1OXC0AZrlL+zCgDd+Y7EK uHdis4MSaLwtPuBkD86VjlSIJ4cGGsSx/aDgaDMfo+hlbwJ37Hq4M8las2nsWUVWBh+xvES0I V+5s1EaBQtJUHm+E9QEnoutbTl3MfMKC4GiM3rmVn6t2MLa/4+PytCsObSJXK1DrjFPgEFv8+ +5JYjiqhAiZbNw8BjL07R45NWwmKDnEml21OCEVgdTF/hdxfVsV4Fe2gKue+/yFik4zl8LRiW qPWkPSaCmNrfXX9x3v2J5GxeZ/htSyzzOS4fi2BUCU0YItJG3w= X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Paul Eggert writes: Hi Paul, > The problem I was thinking of does not seem to be covered by Tramp > tests. If, for example, I do these shell commands: > > $ ln -s "../penguin:motd" /tmp/foo > $ ls -l /tmp/foo > lrwxrwxrwx 1 eggert eggert 15 Aug 29 19:00 /tmp/foo -> ../penguin:motd > > then (file-truename "/tmp/foo") returns "/penguin:motd" which is not > /tmp/foo's true name as far as Emacs file-oriented commands are > concerned. It is. "/penguin:motd" is not a remote file name by default (it would be only with Tramp's simplified syntax). But this is rather academical; "/penguin:motd:" would be a remote file name. So let's continue with this example. I've changed the link: # ls -l /tmp/foo lrwxrwxrwx 1 albinus albinus 16 Aug 30 10:10 /tmp/foo -> ../penguin:motd: The problem in returning a remote file name still exists, maybe you could check your change, again? (file-truename "/tmp/foo") goes remote to "/penguin:motd:". For Tramp, we have (file-truename "/ssh::/tmp/foo") => "/ssh:hostname:/penguin:motd:" This is not wrong, but I'd prefer to get its quoted variant "/ssh:hostname:/:/penguin:motd:". Will work on this. And I'll add your test to tramp-tests.el. Best regards, Michael.