bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28156: Emacs quietly munges symlink contents


From: Paul Eggert
Subject: bug#28156: Emacs quietly munges symlink contents
Date: Thu, 24 Aug 2017 22:12:28 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Michael Albinus wrote:

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.

That should not be a problem with the proposed patch, as it does not affect how Tramp handles TARGET when making a remote symlink.

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

Yes, adding support for /: for interactive use sounds reasonable. I updated the patch to do that; please see attached.

For a TARGET which looks like a remote file name, I propose to keep the
current behaviour (stripping the remote part).

That's fine if LINKNAME is also remote, since symlinks act locally. That is, if TARGET and LINKNAME are both remote to the same filesystem, Tramp can continue to munge TARGET so that it works on that filesystem. However, Tramp should not be in the business of specifying symlink behavior for local symbolic links. It should let the OS do that. If LINKNAME is local, TARGET should just act as itself without Tramp getting in the way.

it is just proper file name quoting

The target of a local symbolic link is a string. It need not name a file, and often does not name a file. Trying to apply some file name rules to it, and not others, is confusing and leads to broken code. For backward compatibility we appear to need to handle leading ~ in interactive use and to provide an escape for leading ~, but let's not try to inflict these complex rules on code. For code, make-symbolic-link should just treat a local target as a string, the way the OS does.

Attachment: 0001-Do-not-munge-contents-of-local-symbolic-links.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]