[Top][All Lists]

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

Re: Upgrading elpa packages results in Lisp nesting exceeds max-lisp-eva

From: Stefan Monnier
Subject: Re: Upgrading elpa packages results in Lisp nesting exceeds max-lisp-eval-depth...
Date: Sun, 06 Oct 2019 13:11:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> I don't know about the OP, but I myself don't use helm and nothing
>> helm-related seems to be installed:
>> ~ $ v .elpa/helm*
>> .elpa/helm*: No such file or directory
>> So why would I get the error, then?
> Hmm, the error happens in `async-bytecomp-get-allowed-pkgs', it loops
> over `async-bytecomp-allowed-packages' which includes helm (hardcoded in
> async-bytecomp.el !).  When you upgrade packages
> `async-bytecomp-get-allowed-pkgs' is called and that produces the issue
> no matter which packages you have installed.

Indeed it's a bug in async.el.
Does the patch below help?

[ Of course, package--get-deps should be fixed accordingly.  ]


diff --git a/packages/async/async-bytecomp.el b/packages/async/async-bytecomp.el
index 082b31adb..ae24cfce8 100644
--- a/packages/async/async-bytecomp.el
+++ b/packages/async/async-bytecomp.el
@@ -108,46 +108,30 @@ All *.elc files are systematically deleted before 
 (defvar package-alist)
 (declare-function package-desc-reqs "package.el" (cl-x))
-(defun async-bytecomp--get-package-deps (pkg &optional only)
+(defun async-bytecomp--get-package-deps (pkgs)
   ;; Same as `package--get-deps' but parse instead `package-archive-contents'
   ;; because PKG is not already installed and not present in `package-alist'.
   ;; However fallback to `package-alist' in case PKG no more present
   ;; in `package-archive-contents' due to modification to `package-archives'.
   ;; See issue #58.
-  (let* ((pkg-desc (cadr (or (assq pkg package-archive-contents)
-                             (assq pkg package-alist))))
-         (direct-deps (cl-loop for p in (package-desc-reqs pkg-desc)
-                               for name = (car p)
-                               when (or (assq name package-archive-contents)
-                                        (assq name package-alist))
-                               collect name))
-         (indirect-deps (unless (eq only 'direct)
-                          (delete-dups
-                           (cl-loop for p in direct-deps append
-                                    (async-bytecomp--get-package-deps p))))))
-    (cl-case only
-      (direct   direct-deps)
-      (separate (list direct-deps indirect-deps))
-      (indirect indirect-deps)
-      (t        (delete-dups (append direct-deps indirect-deps))))))
-(defun async-bytecomp-get-allowed-pkgs ()
-  (when (and async-bytecomp-allowed-packages
-             (listp async-bytecomp-allowed-packages))
-    (if package-archive-contents
-        (cl-loop for p in async-bytecomp-allowed-packages
-                 when (assq p package-archive-contents)
-                 append (async-bytecomp--get-package-deps p) into reqs
-                 finally return
-                 (delete-dups
-                  (append async-bytecomp-allowed-packages reqs)))
-        async-bytecomp-allowed-packages)))
+  (let ((seen '()))
+    (while pkgs
+      (let ((pkg (pop pkgs)))
+        (if (memq pkg seen)
+            nil ;; Done already!
+          (let ((pkg-desc (cadr (or (assq pkg package-archive-contents)
+                                    (assq pkg package-alist)))))
+            (when pkg-desc
+              (push pkg seen)
+              (setq pkgs (nconc pkgs (package-desc-reqs pkg-desc))))))))
+    seen))
 (defun async--package-compile (orig-fun pkg-desc &rest args)
   (let ((cur-package (package-desc-name pkg-desc))
         (pkg-dir (package-desc-dir pkg-desc)))
-    (if (or (equal async-bytecomp-allowed-packages '(all))
-            (memq cur-package (async-bytecomp-get-allowed-pkgs)))
+    (if (or (member async-bytecomp-allowed-packages '(t all (all)))
+            (memq cur-package (async-bytecomp--get-package-deps
+                               async-bytecomp-allowed-packages)))
           ;; FIXME: Why do we use (eq cur-package 'async) once
           ;; and (string= cur-package "async") afterwards?

reply via email to

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