Let Emacs start even if curdir is inaccessible

* lisp/startup.el (normal-top-level): Also delete PWD if
file-attributes fails for either $PWD or default-directory,
instead of failing out of the top level.
This fixes a regression from Emacs 26 (Bug#42903).
This commit is contained in:
Paul Eggert 2020-08-17 16:21:36 -07:00
parent dd989c0ea0
commit 362ca83a3b

View file

@ -649,11 +649,12 @@ It is the default value of the variable `top-level'."
;; Use FOO/., so that if FOO is a symlink, file-attributes
;; describes the directory linked to, not FOO itself.
(or (and default-directory
(equal (file-attributes
(concat (file-name-as-directory pwd) "."))
(file-attributes
(concat (file-name-as-directory default-directory)
"."))))
(ignore-errors
(equal (file-attributes
(concat (file-name-as-directory pwd) "."))
(file-attributes
(concat (file-name-as-directory default-directory)
".")))))
(setq process-environment
(delete (concat "PWD=" pwd)
process-environment)))))