diff options
| author | Paul Eggert | 2017-08-26 18:36:38 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-08-26 18:36:38 -0700 |
| commit | e8001d4c27e1e33c83b9994aac4d5fc3feada2da (patch) | |
| tree | 6910256d7cf7723aa1b3f7ab7779b91627ba52f6 /etc | |
| parent | 937d9d7f60460edb1d3f978151599fddcbba2214 (diff) | |
| download | emacs-e8001d4c27e1e33c83b9994aac4d5fc3feada2da.tar.gz emacs-e8001d4c27e1e33c83b9994aac4d5fc3feada2da.zip | |
Do not munge contents of local symbolic links
This lets Emacs deal with arbitrary local symlinks without
mishandling their contents (Bug#28156). For example,
(progn (shell-command "ln -fs '~' 'x'") (rename-file "x" "/tmp/x"))
now consistently creates a symbolic link from '/tmp/x' to '~'.
Formerly, it did that only if the working directory was on the
same filesystem as /tmp; otherwise, it expanded the '~' to
the user's home directory.
* lisp/dired.el (dired-get-filename): Use files--name-absolute-system-p
instead of rolling our own code.
* lisp/files.el (files--name-absolute-system-p): New function.
(file-truename, file-chase-links): Use it to avoid mishandling
symlink contents that begin with ~.
(copy-directory, move-file-to-trash):
Use concat rather than expand-file-name, to avoid mishandling
symlink contents that begin with ~.
* src/fileio.c (Fmake_symbolic_link): Do not expand leading "~" in the
target unless interactive. Strip leading "/:" if interactive.
(emacs_readlinkat): Do not prepend "/:" to the link target if
it starts with "/" and contains ":" before NUL.
* test/src/fileio-tests.el (try-link): Rename from try-char,
and accept a string instead of a char. All uses changed.
(fileio-tests--symlink-failure): Also test leading ~, and "/:",
to test the new behavior.
Diffstat (limited to 'etc')
| -rw-r--r-- | etc/NEWS | 24 |
1 files changed, 24 insertions, 0 deletions
| @@ -1228,6 +1228,30 @@ instead of to utf-8. Before this change, Emacs would sometimes | |||
| 1228 | mishandle file names containing these control characters. | 1228 | mishandle file names containing these control characters. |
| 1229 | 1229 | ||
| 1230 | +++ | 1230 | +++ |
| 1231 | ** 'file-attributes', 'file-symlink-p' and 'make-symbolic-link' no | ||
| 1232 | longer quietly mutate the target of a local symbolic link, so that | ||
| 1233 | Emacs can access and copy them reliably regardless of their contents. | ||
| 1234 | The following changes are involved. | ||
| 1235 | |||
| 1236 | *** 'file-attributes' and 'file-symlink-p' no longer prepend "/:" to | ||
| 1237 | symbolic links whose targets begin with "/" and contain ":". For | ||
| 1238 | example, if a symbolic link "x" has a target "/y:z", (file-symlink-p | ||
| 1239 | "x") now returns "/y:z" rather than "/:/y:z". | ||
| 1240 | |||
| 1241 | *** 'make-symbolic-link' no longer looks for file name handlers when | ||
| 1242 | creating a local symbolic link. For example, (make-symbolic-link | ||
| 1243 | "/y:z" "x") now creates a symlink to "/y:z" instead of failing. | ||
| 1244 | |||
| 1245 | *** 'make-symbolic-link' now expands a link target with leading "~" | ||
| 1246 | only when the optional third arg is an integer, as when invoked | ||
| 1247 | interactively. For example, (make-symbolic-link "~y" "x") now creates | ||
| 1248 | a link with target the literal string "~y"; to get the old behavior, | ||
| 1249 | use (make-symbolic-link (expand-file-name "~y") "x"). To avoid this | ||
| 1250 | expansion in interactive use, you can now prefix the link target with | ||
| 1251 | "/:". For example, (make-symbolic-link "/:~y" "x" 1) now creates a | ||
| 1252 | link to literal "~y". | ||
| 1253 | |||
| 1254 | +++ | ||
| 1231 | ** Module functions are now implemented slightly differently; in | 1255 | ** Module functions are now implemented slightly differently; in |
| 1232 | particular, the function 'internal--module-call' has been removed. | 1256 | particular, the function 'internal--module-call' has been removed. |
| 1233 | Code that depends on undocumented internals of the module system might | 1257 | Code that depends on undocumented internals of the module system might |