1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

Fix PWD startup checking with symlinks

* lisp/startup.el (normal-top-level): Do not put "." after "/";
it’s not needed and with current file-name-as-directory it does
the wrong thing if PWD is a symlink.
This commit is contained in:
Paul Eggert 2020-08-26 10:53:32 -07:00
parent dfeb059312
commit ff864be694

View File

@ -642,16 +642,13 @@ It is the default value of the variable `top-level'."
(list (default-value 'user-full-name)))
;; If the PWD environment variable isn't accurate, delete it.
(let ((pwd (getenv "PWD")))
(and (stringp pwd)
;; Use FOO/., so that if FOO is a symlink, file-attributes
;; describes the directory linked to, not FOO itself.
(and pwd
(or (and default-directory
(ignore-errors
(equal (file-attributes
(concat (file-name-as-directory pwd) "."))
(file-name-as-directory pwd))
(file-attributes
(concat (file-name-as-directory default-directory)
".")))))
(file-name-as-directory default-directory)))))
(setq process-environment
(delete (concat "PWD=" pwd)
process-environment)))))