emacs-devel
[Top][All Lists]
Advanced

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

Re: seq; Error during initial package install


From: Philip Kaludercic
Subject: Re: seq; Error during initial package install
Date: Sat, 27 Apr 2024 09:17:17 +0000

Eli Zaretskii <eliz@gnu.org> writes:

>> From: "Parker, Ron" <Ron.Parker@netapp.com>
>> Date: Thu, 18 Apr 2024 18:29:19 +0000
>> 
>> When I start Emacs on a fresh install of my configuration, I have to
>> restart a couple times before all of the packages successfully install.
>> Upon trying to debug it, I ran into an error with seq being unable to
>> load seq-25.el and reduced it to a minimal test case.
>>  
>> Put the following in an empty directory as init.el:
>>  
>>   (setq debug-on-error t
>>         package-install-upgrade-built-in t)
>>   (package-install 'seq)
>>  
>> then in the directory run:
>>  
>>   emacs -Q --init-directory $(pwd) -l init.el
>>  
>> When I do this, I get the following error:
>>  
>>   Debugger entered--Lisp error: (file-missing "Cannot open load file" "No 
>> such file or directory" "seq-25")
>>     require(seq-25)
>>     (if (version< emacs-version "25") (require 'seq-24) (require 'seq-25))

The issue is that package.el is re-loading the built-in seq, but all the
seq.el on ELPA does is try to load the right version of seq (for Emacs
24 or 25, as seen above).  At this point the load-path has not been
modified yet, which is why `require' fails.  I see two solutions:

1. Temporarily prepends the directory to load-path:

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ab1731aeb54..9eea1c45db5 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -871,8 +871,9 @@ package--reload-previously-loaded
           (unless (equal (file-name-base library)
                          (format "%s-autoloads" (package-desc-name pkg-desc)))
             (push (cons (expand-file-name library dir) recent-index) result))))
-      (mapc (lambda (c) (load (car c) nil t))
-            (sort result (lambda (x y) (< (cdr x) (cdr y))))))))
+      (let ((load-path (cons dir load-path)))
+        (mapc (lambda (c) (load (car c) nil t))
+              (sort result (lambda (x y) (< (cdr x) (cdr y)))))))))
 
 (defun package-activate-1 (pkg-desc &optional reload deps)
   "Activate package given by PKG-DESC, even if it was already active.

2. Loads the autoload file before reloading the package, thus updating
load-path, since this is done in the autoloads file:

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ab1731aeb54..bed0122e8ca 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -898,10 +898,10 @@ package-activate-1
       (if (listp package--quickstart-pkgs)
           ;; We're only collecting the set of packages to activate!
           (push pkg-desc package--quickstart-pkgs)
-        (when reload
-          (package--reload-previously-loaded pkg-desc))
         (with-demoted-errors "Error loading autoloads: %s"
-          (load (package--autoloads-file-name pkg-desc) nil t)))
+          (load (package--autoloads-file-name pkg-desc) nil t))
+        (when reload
+          (package--reload-previously-loaded pkg-desc)))
       ;; Add info node.
       (when (file-exists-p (expand-file-name "dir" pkg-dir))
         ;; FIXME: not the friendliest, but simple.

I cannot test this right now, since there appears to be an unrelated
issue with elpa.gnu.org's signing keys?

>>     
>> load-with-code-conversion("/Users/<username>/.emacs-test-elpa-seq/elpa/seq-2.24/seq..."
>> "/Users/<username>/.emacs-test-elpa-seq/elpa/seq-2.24/seq..." nil t)
>>     #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_32>
>> (("/Users/<username>/.emacs-test-elpa-seq/elpa/seq-2.24/seq" . 76))
>>     mapc(#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_32>
>> (("/Users/<username>/.emacs-test-elpa-seq/elpa/seq-2.24/seq" . 76)))
>>     package--reload-previously-loaded(#s(package-desc :name seq :version (2 
>> 24) :summary "Sequence
>> manipulation functions" :reqs nil :kind nil :archive nil :dir
>> "/Users/<username>/.emacs-test-elpa-seq/elpa/seq-2.24" :extras ((:keywords 
>> "sequences") (:maintainer nil .
>> emacs-devel@gnu.org) (:authors ("Nicolas Petton" . nicolas@petton.fr)) (:url 
>> .
>> https://elpa.gnu.org/packages/seq.html) (:commit . 
>> "27a90793a13f149121180e864fa53d68b9eac0b3")) :
>> signed nil))
>> 
>>     package-activate-1(#s(package-desc :name seq :version (2 24) :summary 
>> "Sequence manipulation
>> functions" :reqs nil :kind nil :archive nil :dir 
>> "/Users/<username>/.emacs-test-elpa-seq/elpa/seq-2.24" :extras
>> ((:keywords "sequences") (:maintainer nil . emacs-devel@gnu.org) (:authors 
>> ("Nicolas Petton" .
>> nicolas@petton.fr)) (:url . https://elpa.gnu.org/packages/seq.html) (:commit 
>> .
>> "27a90793a13f149121180e864fa53d68b9eac0b3")) :signed nil) :reload :deps)
>> 
>>     package-unpack(#s(package-desc :name seq :version (2 24) :summary 
>> "Sequence manipulation functions"
>> :reqs nil :kind tar :archive "gnu" :dir nil :extras ((:keywords "sequences") 
>> (:maintainer nil .
>> emacs-devel@gnu.org) (:authors ("Nicolas Petton" . nicolas@petton.fr)) (:url 
>> .
>> https://elpa.gnu.org/packages/seq.html) (:commit . 
>> "27a90793a13f149121180e864fa53d68b9eac0b3")) :
>> signed nil))
>> 
>>     #f(compiled-function () #<bytecode 0x1511bb8ba7930de3>)()
>> 
>>     package--with-response-buffer-1(https://elpa.gnu.org/packages/ 
>> #f(compiled-function () #<bytecode
>> 0x1511bb8ba7930de3>) :file "seq-2.24.tar" :async nil :error-function #<subr
>> F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_79> :noerror nil)
>> 
>>     package-install-from-archive(#s(package-desc :name seq :version (2 24) 
>> :summary "Sequence
>> manipulation functions" :reqs nil :kind tar :archive "gnu" :dir nil :extras 
>> ((:keywords "sequences") (:maintainer
>> nil . emacs-devel@gnu.org) (:authors ("Nicolas Petton" . nicolas@petton.fr)) 
>> (:url .
>> https://elpa.gnu.org/packages/seq.html) (:commit . 
>> "27a90793a13f149121180e864fa53d68b9eac0b3")) :
>> signed nil))
>> 
>>     package-download-transaction((#s(package-desc :name seq :version (2 24) 
>> :summary "Sequence
>> manipulation functions" :reqs nil :kind tar :archive "gnu" :dir nil :extras 
>> ((:keywords "sequences") (:maintainer
>> nil . emacs-devel@gnu.org) (:authors ("Nicolas Petton" . nicolas@petton.fr)) 
>> (:url .
>> https://elpa.gnu.org/packages/seq.html) (:commit . 
>> "27a90793a13f149121180e864fa53d68b9eac0b3")) :
>> signed nil)))
>>     package-install(seq)
>>     
>> load-with-code-conversion("/Users/<username>/.emacs-test-elpa-seq/init.el"
>> "/Users/<username>/.emacs-test-elpa-seq/init.el" nil t)
>>     command-line-1(("-l" "init.el" "init.el"))
>>     command-line()
>>     normal-top-level()
>>  
>> Emacs  : GNU Emacs 29.1 (build 1, aarch64-apple-darwin23.2.0, NS 
>> appkit-2487.30 Version 14.2.1 (Build
>> 23C71))
>> 
>> Package: seq
>
> Stefan and Philip, any comments or suggestions?

-- 
        Philip Kaludercic on peregrine



reply via email to

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