diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-12-05 02:13:00 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-12-05 02:13:00 +0100 |
commit | f14a4c377dfa6602e9e159c806656137854a667b (patch) | |
tree | a52050beed6cb079cb97546e8b862cd870fdea39 /lisp/emacs-lisp | |
parent | dbadbb5badb26a006f562374127c180a27c11f70 (diff) | |
download | emacs-f14a4c377dfa6602e9e159c806656137854a667b.tar.gz emacs-f14a4c377dfa6602e9e159c806656137854a667b.tar.bz2 emacs-f14a4c377dfa6602e9e159c806656137854a667b.zip |
Make package-dir-info more resilient
* lisp/emacs-lisp/package.el (package-dir-info): Check that the
file exists before using it (bug#41489).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/package.el | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 08dfe504d27..66bbd631a72 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1181,13 +1181,17 @@ The return result is a `package-desc'." info) (while files (with-temp-buffer - (insert-file-contents (pop files)) - ;; When we find the file with the data, - (when (setq info (ignore-errors (package-buffer-info))) - ;; stop looping, - (setq files nil) - ;; set the 'dir kind, - (setf (package-desc-kind info) 'dir)))) + (let ((file (pop files))) + ;; The file may be a link to a nonexistent file; e.g., a + ;; lock file. + (when (file-exists-p file) + (insert-file-contents file) + ;; When we find the file with the data, + (when (setq info (ignore-errors (package-buffer-info))) + ;; stop looping, + (setq files nil) + ;; set the 'dir kind, + (setf (package-desc-kind info) 'dir)))))) (unless info (error "No .el files with package headers in `%s'" default-directory)) ;; and return the info. |