|
From: | Paul Eggert |
Subject: | bug#28156: Emacs quietly munges symlink contents |
Date: | Mon, 21 Aug 2017 08:58:59 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
Eli Zaretskii wrote:
What if readlink returns a name such as "/ssh:foo@bar:/quux"? A symlink cannot have a remote file name as its target, can it?
A symlink target is a string, and can have any bytes in it (other than NUL). So if FOO is a remote file name then it can have FOO as a target. Of course the OS won't interpret the remote file name on its own, just as it won't interpret ~ or $ or whatever, but that is OK and expected.
read-file-name gets the string from the user, so it's an entirely different context.
It was just one example, though it remains a good one. Another example is (directory-files dir), which does not escape its results even when they begin with ~. Really, there is no need or good precedent for the sort of escaping that you propose. It is much simpler (and agrees with the documentation and intuition) for file-symlink-p to return the results as-is, like directory-files does.
[Prev in Thread] | Current Thread | [Next in Thread] |