From: Michael Albinus <michael.albinus@gmx.de>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: p.stephani2@gmail.com, 28156@debbugs.gnu.org
Subject: bug#28156: Emacs quietly munges symlink contents
Date: Thu, 24 Aug 2017 13:38:29 +0200 [thread overview]
Message-ID: <87a82p8abu.fsf@detlef> (raw)
In-Reply-To: <787f2dca-7135-3da5-4516-99d12ecf8edd@cs.ucla.edu> (Paul Eggert's message of "Tue, 22 Aug 2017 09:03:52 -0700")
Paul Eggert <eggert@cs.ucla.edu> 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.
next prev parent reply other threads:[~2017-08-24 11:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-20 10:28 bug#28156: Emacs quietly munges symlink contents Paul Eggert
2017-08-20 13:48 ` Michael Albinus
2017-08-20 14:37 ` Eli Zaretskii
2017-08-20 15:09 ` Philipp Stephani
2017-08-20 15:38 ` Eli Zaretskii
2017-08-20 17:54 ` Paul Eggert
2017-08-20 18:28 ` Michael Albinus
2017-08-20 18:53 ` Paul Eggert
2017-08-20 19:15 ` Michael Albinus
2017-08-20 21:47 ` Paul Eggert
2017-08-21 7:36 ` Michael Albinus
2017-08-20 19:21 ` Eli Zaretskii
2017-08-20 21:31 ` Paul Eggert
2017-08-21 2:34 ` Eli Zaretskii
2017-08-21 8:34 ` Paul Eggert
2017-08-21 14:25 ` Eli Zaretskii
2017-08-21 15:58 ` Paul Eggert
2017-08-20 19:16 ` Eli Zaretskii
2017-08-21 17:34 ` Paul Eggert
2017-08-21 17:59 ` Eli Zaretskii
2017-08-21 20:30 ` Paul Eggert
2017-08-22 7:28 ` Michael Albinus
2017-08-22 16:03 ` Paul Eggert
2017-08-24 11:38 ` Michael Albinus [this message]
2017-08-25 5:12 ` Paul Eggert
2017-08-25 12:45 ` Michael Albinus
2017-08-26 13:16 ` Michael Albinus
2017-08-27 1:53 ` Paul Eggert
2017-08-20 22:19 ` npostavs
2017-08-20 23:00 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a82p8abu.fsf@detlef \
--to=michael.albinus@gmx.de \
--cc=28156@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=p.stephani2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.