GNU bug report logs - #40971
Updating built-in packages that seq depends on is broken due to a bug in package.el

Previous Next

Package: emacs;

Reported by: Clément Pit-Claudel <cpitclaudel <at> gmail.com>

Date: Wed, 29 Apr 2020 19:48:01 UTC

Severity: normal

Full log


Message #11 received at 40971 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
To: 40971 <at> debbugs.gnu.org
Subject: Re: Updating built-in packages that seq depends on is broken due to a
 bug in package.el
Date: Mon, 11 May 2020 15:06:20 -0400
On 05/05/2020 23.35, Stefan Monnier wrote:
> Hmm... have you traced this function to see how it's called and what 
> it returns? AFAIK `seq.el.gz` should "never" be loaded (it's 
> `seq.elc` which is loaded), so I'm not sure it can make much 
> difference.

I did :) Here's the function:

(defun package--list-loaded-files (dir)
  "Recursively list all files in DIR which correspond to loaded features.
Returns the `file-name-sans-extension' of each file, relative to
DIR, sorted by most recently loaded last."
  (let* ((history (delq nil
                        (mapcar (lambda (x)
                                  (let ((f (car x)))
                                    (and (stringp f)
(1)                                      (file-name-sans-extension f))))
                                load-history)))
         (dir (file-truename dir))
         ;; List all files that have already been loaded.
         (list-of-conflicts
          (delq
           nil
           (mapcar
               (lambda (x) (let* ((file (file-relative-name x dir))
                             ;; Previously loaded file, if any.
                             (previous
                              (ignore-errors
                                (file-name-sans-extension
(2)                              (file-truename (find-library-name file)))))
                             (pos (when previous (member previous history))))
                        ;; Return (RELATIVE-FILENAME . HISTORY-POSITION)
                        (when pos
                          (cons (file-name-sans-extension file) (length pos)))))
             (directory-files-recursively dir "\\`[^\\.].*\\.el\\'")))))

On line (1) it uses file-name-sans-extension when iterating over load-history.  On line (2) it uses file-name-sans-extension + find-library-name when iterating over the package's files.
The problem is find-library-name: (find-library-name file) returns "/usr/local/share/emacs/28.0.50/lisp/emacs-lisp/seq.el.gz"

> Furthermore, I think that when activating packages at startup we 
> don't bother to look for already loaded files and reload them.  We 
> only do that *during* a package upgrade (in order to try and avoid 
> having the old version's macros&functions get in the way while 
> compiling the new code, mostly).

Good point.




This bug report was last modified 5 years and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.