aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-08-26 19:28:34 +0200
committerLars Ingebrigtsen2021-08-26 19:28:34 +0200
commitee2ffd9c9eb33a17307f36ff58caec1ba79878d2 (patch)
tree25d577dcf8d295c13d6c8bd931d0b398f7ac3f4f
parent869579170b87b06dd802b563417a69564c82f559 (diff)
downloademacs-ee2ffd9c9eb33a17307f36ff58caec1ba79878d2.tar.gz
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).
-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)."
2951 fmts formats) 2951 fmts formats)
2952 ;; For each directory, try each format string. 2952 ;; For each directory, try each format string.
2953 (while (and fmts (null buffer)) 2953 (while (and fmts (null buffer))
2954 (setq name (expand-file-name (format (car fmts) filename) thisdir) 2954 (setq name (file-truename
2955 (file-name-concat thisdir (format (car fmts) filename)))
2955 buffer (and (file-exists-p name) 2956 buffer (and (file-exists-p name)
2956 (find-file-noselect name)) 2957 (find-file-noselect name))
2957 fmts (cdr fmts))) 2958 fmts (cdr fmts)))
@@ -2973,7 +2974,8 @@ attempts to find a file whose name is produced by (format FMT FILENAME)."
2973 (setq thisdir (car dirs) 2974 (setq thisdir (car dirs)
2974 fmts formats) 2975 fmts formats)
2975 (while (and fmts (null buffer)) 2976 (while (and fmts (null buffer))
2976 (setq name (expand-file-name (format (car fmts) filename) thisdir) 2977 (setq name (file-truename
2978 (file-name-concat thisdir (format (car fmts) filename)))
2977 buffer (and (file-exists-p name) 2979 buffer (and (file-exists-p name)
2978 (find-file-noselect name)) 2980 (find-file-noselect name))
2979 fmts (cdr fmts))) 2981 fmts (cdr fmts)))
@@ -3016,7 +3018,8 @@ attempts to find a file whose name is produced by (format FMT FILENAME)."
3016 (ding) (sit-for 2)) 3018 (ding) (sit-for 2))
3017 ((and (file-directory-p name) 3019 ((and (file-directory-p name)
3018 (not (file-exists-p 3020 (not (file-exists-p
3019 (setq name (expand-file-name filename name))))) 3021 (setq name (file-truename
3022 (file-name-concat name filename))))))
3020 (message "No `%s' in directory %s" filename origname) 3023 (message "No `%s' in directory %s" filename origname)
3021 (ding) (sit-for 2)) 3024 (ding) (sit-for 2))
3022 (t 3025 (t