bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#34462: 27.0.50; package.el breakage when features are loaded in afte


From: Dmitry Alexandrov
Subject: bug#34462: 27.0.50; package.el breakage when features are loaded in after-init-hook
Date: Wed, 13 Feb 2019 11:06:01 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Steve Purcell <steve@sanityinc.com> wrote:
> Given an init.el snippet like:
>
>     (add-hook 'after-init-hook
>               (lambda ()
>                 (require 'server)
>                 (unless (server-running-p)
>                   (server-start))))
>
> the `load-history' var will contain an entry with a nil car (as per its
> documentation), inside which the `(require . server)' load will be
> noted.
>
> However, the code in `package--list-loaded-files' unconditionally
> applies `file-name-sans-extension' to the cars of `load-history',
> resulting in errors whenever packages are activated (e.g. upgraded,
> installed).
>
> I believe the correct fix would be simply add a `stringp' test here:
>
> https://github.com/emacs-mirror/emacs/blob/5abaf16ab49b86ca5add981c2ddcaea6db0c8a08/lisp/emacs-lisp/package.el#L759
>
> (Using a nightly Emacs HEAD snapshot from a couple of days ago.)

This is actually not limited to package.el.  E. g. lisp/help-fns.el was also 
written in assumtion, that cars of elements of ‘load-history’ are always file 
names:

(defun help-fns--autoloaded-p (function file)
  "Return non-nil if FUNCTION has previously been autoloaded.
FILE is the file where FUNCTION was probably defined."
  (let* ((file (file-name-sans-extension (file-truename file)))
         (load-hist load-history)
         (target (cons t function))
         found)
    (while (and load-hist (not found))
      (and (caar load-hist)
           (equal (file-name-sans-extension (caar load-hist)) file)
           (setq found (member target (cdar load-hist))))
      (setq load-hist (cdr load-hist)))
    found))
Moreover:

$ emacs -Q
<f1> f emacs-lisp-mode RET

Debugger entered--Lisp error: (wrong-type-argument stringp (require . 
elec-pair))
  file-name-nondirectory((require . elec-pair))
  file-name-sans-extension((require . elec-pair))
  help-fns--autoloaded-p(emacs-lisp-mode 
"/var/share/pub/src/emacs.~21eef9fa7f~/lisp/progmod...")
  help-fns-function-description-header(emacs-lisp-mode)
  describe-function-1(emacs-lisp-mode)
  describe-function(emacs-lisp-mode)
  funcall-interactively(describe-function emacs-lisp-mode)
  call-interactively(describe-function nil nil)
  command-execute(describe-function)
So something forgot to put there even nil, but started the list right with 
ENTRIES.

Attachment: signature.asc
Description: PGP signature


reply via email to

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