From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#28156: Emacs quietly munges symlink contents Date: Thu, 24 Aug 2017 13:38:29 +0200 Message-ID: <87a82p8abu.fsf@detlef> References: <68b2e6ef-bf0b-ebcf-c577-d296952d593f@cs.ucla.edu> <83pobqcnlf.fsf@gnu.org> <83h8x2ckqn.fsf@gnu.org> <83bmnacaob.fsf@gnu.org> <1fafa4ea-424e-53c5-3c91-6dd18fe47f1e@cs.ucla.edu> <83bmn8by40.fsf@gnu.org> <5963ac31-06cc-7784-bf21-46b76bd77c51@cs.ucla.edu> <87tw10qcwz.fsf@detlef> <787f2dca-7135-3da5-4516-99d12ecf8edd@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1503574752 10858 195.159.176.226 (24 Aug 2017 11:39:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 24 Aug 2017 11:39:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: p.stephani2@gmail.com, 28156@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 24 13:39:06 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 1dkqTW-0002LS-Vx for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Aug 2017 13:39:03 +0200 Original-Received: from localhost ([::1]:47895 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkqTd-0004i1-El for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Aug 2017 07:39:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkqTX-0004hv-Hj for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2017 07:39:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dkqTW-0007aD-7q for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2017 07:39:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43540) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dkqTW-0007Zu-37 for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2017 07:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dkqTV-00044e-MZ for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2017 07:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Aug 2017 11:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28156 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 28156-submit@debbugs.gnu.org id=B28156.150357473415648 (code B ref 28156); Thu, 24 Aug 2017 11:39:01 +0000 Original-Received: (at 28156) by debbugs.gnu.org; 24 Aug 2017 11:38:54 +0000 Original-Received: from localhost ([127.0.0.1]:52221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dkqTO-00044J-As for submit@debbugs.gnu.org; Thu, 24 Aug 2017 07:38:54 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:58268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dkqTK-000444-PH for 28156@debbugs.gnu.org; Thu, 24 Aug 2017 07:38:53 -0400 Original-Received: from detlef.gmx.de ([178.20.93.162]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MIdYi-1didXc35Oy-002KOv; Thu, 24 Aug 2017 13:38:33 +0200 In-Reply-To: <787f2dca-7135-3da5-4516-99d12ecf8edd@cs.ucla.edu> (Paul Eggert's message of "Tue, 22 Aug 2017 09:03:52 -0700") X-Provags-ID: V03:K0:PHy3nfCDdjAMt9jcRmdjGuFoHou2BoCMxHwArWn5MPbj//zmEiL YR+9BGICkO51gCfdklvOo36XvRwPawEwxjhryXMQ0xDoDttm1/RStezOgoDd7iROLAV11Uf Dlm9W8JHLQ8vUbfJcB8KUH/8VZyxU7kH8NRtdSps+CYZOCWZmPOm9tNF0igzI9jMJ3hxr6H 4PRlAyWjUilXM6HLsaccA== X-UI-Out-Filterresults: notjunk:1;V01:K0:k64UMCb0wSk=:/BROMZSSmT4y1jmARynyvj xUdcVGJOxj/AXwG8mK+lPuzSz0nuwI2D96Pf847UDZPnPSpLQ/Phmc3VVfOHlMoT7zJ8TmHcD QNCCK/QSZLykU+X37/wLCqEJhzCDhN3aGjLTPoOh0qJyP2/AOkwAENzHbRQL4+4wQTSwTOZYy QmnJrLQdOuxx3NiEGBV3LX07FUEry1Wy0x1RKn/U/Y5hQEDoc2LAU/H5XTpSo9q+Cf9wpVgB7 hS7Y8PRRN3dCOR49WIDdB4lkfAAwOOnJZbY2PBXCg52iZOLfSohSLMUEjFVVEitqaBBjqNcDz eZLSOLjn/TZuQMXbI/FwJA6CZNpyfVRwR6ysZF1eO52zUfYXDF9yEIrgb+AqOMBHHIDaV4ed1 jYRRMp5lQ1HsvbtVMYC8gMBMnT/bAz5ESg68RuN1kDUK8HyE1IClwCa5rKCrz7bmvC/4TnuRr y1Pbld5VLntCd5e8A+2GGyq9YwdBMmodkF183ZdUbkIxgW/tOPUQctMwEjkycutGZJVqd+2Hz Tss4wTQMswBrd/68KMcMWZFvifwPjhzrmKp/CSuA0AIIGBFpR83sJOhAVJwT6njedVjPp/x2f hE7V8koaYvG3+w0Rh5rg53BC9QGbEm69o52tP6G8dH00924e/Gf387gqyd/V4v3HmAslth3Hw gXX8z6Y+eizYDk38ajuk+baA5r77eE8zfd/JMfSVCaJofwWPIE5gBxF9IniJe6ZFEblBv11Kz Ii0bEqlozsBKXqX6vl/GBsvrYM0CG+H8d1YXYHTWEmb6n++O7K6baefGe1CmdpiKY4wahEQm 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:136141 Archived-At: Paul Eggert writes: > On 08/22/2017 12:28 AM, Michael Albinus wrote: >> If you want to have an absolute filename as LINKNAME, you typically call >> >> (make-symbolic-link (expand-file-name target) (expand-file-name linkname)) >> >> In case of remote file names, (expand-file-name linkname) will always >> return something like "/method:user@host:/path/to/linkname". I doubt, >> that a user wants to see this literal string as symbolic link. > > There seems to be some confusion here, as Bug#28156 does not propose > any change to how make-symbolic-link's 2nd argument works, > (expand-file-name linkname) in this case. If the 2nd argument > specifies a remote name, as in your example, then Tramp will take over > and do whatever it wants with both arguments, so Bug#28156 is not > proposing any change there (although perhaps some changes would be > helpful for consistency, that's a different matter). Sorry, I have confused the 1st and 2nd argument of make-symbolic-link. Tramp's docstring is wrong, because it does the same error, for decades. Will fix it. However, it is Tramp's (almost undocumented) make-symbolic-link implementation to handle TARGET as well, and to strip the remote part of this. I wouldn't be surprised if existing packages will be broken if we change this. Coming to your examples, I believe the existing implementation gives you almost all what is needed, with quoting. Using "~" in TARGET: --8<---------------cut here---------------start------------->8--- M-x make-symbolic-link RET /:~eggert RET /tmp/foo RET # ls -l /tmp/foo lrwxrwxrwx 1 albinus albinus 21 Aug 24 13:19 /tmp/foo -> /home/albinus/~eggert --8<---------------cut here---------------end--------------->8--- It is questionable whether "/:~eggert" shall be expanded to "/home/albinus/~eggert". I agree with you, that it shouldn't, the target shall be just "~eggert". Using ":" in TARGET would look like: --8<---------------cut here---------------start------------->8--- M-x make-symbolic-link RET /:/x:y RET /tmp/foo RET # ls -l /tmp/foo lrwxrwxrwx 1 albinus albinus 4 Aug 24 13:23 /tmp/foo -> /x:y --8<---------------cut here---------------end--------------->8--- For a TARGET which looks like a remote file name, I propose to keep the current behaviour (stripping the remote part). It shall be equivalent to just using the local file name of TARGET. So we would have: --8<---------------cut here---------------start------------->8--- M-x make-symbolic-link RET /sudo::/:~eggert RET /sudo::/tmp/bar RET # ls -l /tmp/bar lrwxrwxrwx 1 root root 7 Aug 24 13:26 /tmp/bar -> ~eggert ;; This example does not work yet. M-x make-symbolic-link RET /:~eggert RET /sudo::/tmp/bar RET # ls -l /tmp/bar lrwxrwxrwx 1 root root 7 Aug 24 13:26 /tmp/bar -> ~eggert --8<---------------cut here---------------end--------------->8--- --8<---------------cut here---------------start------------->8--- M-x make-symbolic-link RET /sudo::/:/x:y RET /sudo::/tmp/bar RET # ls -l /tmp/foo lrwxrwxrwx 1 root root 4 Aug 24 13:30 /tmp/bar -> /x:y ;; This example does not work yet. M-x make-symbolic-link RET /:/x:y RET /sudo::/tmp/bar RET # ls -l /tmp/foo lrwxrwxrwx 1 root root 4 Aug 24 13:30 /tmp/bar -> /x:y --8<---------------cut here---------------end--------------->8--- By this, you don't need to handle "~" special in make-symbolic-link, as your patch proposes. After all, it is just proper file name quoting, and fixing the bug mentioned above. Best regards, Michael.