all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Alexandrov <321942@gmail.com>
To: Steve Purcell <steve@sanityinc.com>
Cc: 34462@debbugs.gnu.org
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	[thread overview]
Message-ID: <87wom4f6za.fsf@gmail.com> (raw)
In-Reply-To: <m27ee4dbb1.fsf@sanityinc.com> (Steve Purcell's message of "Wed,  13 Feb 2019 09:03:14 +1300")


[-- Attachment #1.1: Type: text/plain, Size: 1089 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: Type: text/x-emacs-lisp, Size: 523 bytes --]

(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))

[-- Attachment #1.3: Type: text/plain, Size: 51 bytes --]


Moreover:

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.4: Type: text/x-backtrace, Size: 554 bytes --]

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)

[-- Attachment #1.5: Type: text/plain, Size: 85 bytes --]


So something forgot to put there even nil, but started the list right with ENTRIES.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  reply	other threads:[~2019-02-13  8:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 20:03 bug#34462: 27.0.50; package.el breakage when features are loaded in after-init-hook Steve Purcell
2019-02-13  8:06 ` Dmitry Alexandrov [this message]
2019-02-13 11:05   ` Dmitry Alexandrov
2019-02-13 20:08   ` Steve Purcell
2019-02-14 22:41     ` Glenn Morris
2019-02-15  1:45       ` Dmitry Alexandrov
2019-03-01  9:47         ` Eli Zaretskii
2019-02-15  7:23       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wom4f6za.fsf@gmail.com \
    --to=321942@gmail.com \
    --cc=34462@debbugs.gnu.org \
    --cc=steve@sanityinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.