summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-08-26 19:28:34 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-08-26 19:28:34 +0200
commitee2ffd9c9eb33a17307f36ff58caec1ba79878d2 (patch)
tree25d577dcf8d295c13d6c8bd931d0b398f7ac3f4f /lisp
parent869579170b87b06dd802b563417a69564c82f559 (diff)
downloademacs-ee2ffd9c9eb33a17307f36ff58caec1ba79878d2.tar.gz
emacs-ee2ffd9c9eb33a17307f36ff58caec1ba79878d2.tar.bz2
emacs-ee2ffd9c9eb33a17307f36ff58caec1ba79878d2.zip
Fix problem with symlinks in compile buffers
* lisp/progmodes/compile.el (compilation-find-file): Avoid `expand-file-name' when computing the file names, because that will reliably give the wrong result when there's symlinks and ".." involved (bug#8035).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/compile.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 1fb6124ab56..af7b8292b74 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2951,7 +2951,8 @@ attempts to find a file whose name is produced by (format FMT FILENAME)."
fmts formats)
;; For each directory, try each format string.
(while (and fmts (null buffer))
- (setq name (expand-file-name (format (car fmts) filename) thisdir)
+ (setq name (file-truename
+ (file-name-concat thisdir (format (car fmts) filename)))
buffer (and (file-exists-p name)
(find-file-noselect name))
fmts (cdr fmts)))
@@ -2973,7 +2974,8 @@ attempts to find a file whose name is produced by (format FMT FILENAME)."
(setq thisdir (car dirs)
fmts formats)
(while (and fmts (null buffer))
- (setq name (expand-file-name (format (car fmts) filename) thisdir)
+ (setq name (file-truename
+ (file-name-concat thisdir (format (car fmts) filename)))
buffer (and (file-exists-p name)
(find-file-noselect name))
fmts (cdr fmts)))
@@ -3016,7 +3018,8 @@ attempts to find a file whose name is produced by (format FMT FILENAME)."
(ding) (sit-for 2))
((and (file-directory-p name)
(not (file-exists-p
- (setq name (expand-file-name filename name)))))
+ (setq name (file-truename
+ (file-name-concat name filename))))))
(message "No `%s' in directory %s" filename origname)
(ding) (sit-for 2))
(t