From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#28264: Accessing source directory through symlink produces false warnings Date: Tue, 29 Aug 2017 19:20:47 -0700 Organization: UCLA Computer Science Department Message-ID: References: <8fo9qzeei7.fsf@fencepost.gnu.org> <6cd94296-2dd5-ac88-185b-ed7d5d8e5533@cs.ucla.edu> <87378a9kds.fsf@detlef> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------197FD0636636139FD347ABB3" X-Trace: blaine.gmane.org 1504059745 7458 195.159.176.226 (30 Aug 2017 02:22:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 30 Aug 2017 02:22:25 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 Cc: 28264@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 30 04:22:20 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmsdp-00018a-Ci for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Aug 2017 04:22:05 +0200 Original-Received: from localhost ([::1]:47764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmsdv-0000yK-V2 for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Aug 2017 22:22:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmsdp-0000yE-8y for bug-gnu-emacs@gnu.org; Tue, 29 Aug 2017 22:22:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmsdl-0001vx-Vp for bug-gnu-emacs@gnu.org; Tue, 29 Aug 2017 22:22:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52602) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dmsdl-0001vm-Pz for bug-gnu-emacs@gnu.org; Tue, 29 Aug 2017 22:22:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dmsdl-0003d4-Hg for bug-gnu-emacs@gnu.org; Tue, 29 Aug 2017 22:22: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: 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: Original-Received: via spool by 28264-submit@debbugs.gnu.org id=B28264.150405966413884 (code B ref 28264); Wed, 30 Aug 2017 02:22:01 +0000 Original-Received: (at 28264) by debbugs.gnu.org; 30 Aug 2017 02:21:04 +0000 Original-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 Original-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 Original-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) 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 nMY19dnvaq7S; Tue, 29 Aug 2017 19:20:55 -0700 (PDT) Original-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 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 WYPHxrl7qpcs; Tue, 29 Aug 2017 19:20:55 -0700 (PDT) Original-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) In-Reply-To: <87378a9kds.fsf@detlef> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136365 Archived-At: 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--