emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f14a4c3 3/3: Make package-dir-info more resilient


From: Lars Ingebrigtsen
Subject: master f14a4c3 3/3: Make package-dir-info more resilient
Date: Sat, 4 Dec 2021 20:13:49 -0500 (EST)

branch: master
commit f14a4c377dfa6602e9e159c806656137854a667b
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make package-dir-info more resilient
    
    * lisp/emacs-lisp/package.el (package-dir-info): Check that the
    file exists before using it (bug#41489).
---
 lisp/emacs-lisp/package.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 08dfe50..66bbd63 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]