Subject: 27.0.50; package.el breakage when features are loaded in after-init-hook
From: Steve Purcell <[email-masked]>
To: [email-masked]
Date: Wed, 13 Feb 2019 09:03:14 +1300
List-Id: <debbugs-submit.debbugs.gnu.org>

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

In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
 of 2019-02-12 built on Tulku.local
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.3

Recent messages:
Mark set [6 times]
Entering debugger...
Back to top level
Mark set [2 times]
Mark saved where search started
Mark set
Mark saved where search started
Mark set
Quit [2 times]
Entering debugger...

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS PDUMPER

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US
  locale-coding-system: utf-8

Major mode: ELisp

Minor modes in effect:
  global-magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  default-text-scale-mode: t
  recentf-mode: t
  company-quickhelp-mode: t
  company-quickhelp-local-mode: t
  winner-mode: t
  global-anzu-mode: t
  anzu-mode: t
  counsel-mode: t
  diredfl-global-mode: t
  ivy-mode: t
  flycheck-color-mode-line-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  global-company-mode: t
  company-mode: t
  elisp-slime-nav-mode: t
  aggressive-indent-mode: t
  highlight-quoted-mode: t
  display-line-numbers-mode: t
  rainbow-delimiters-mode: t
  symbol-overlay-mode: t
  bug-reference-prog-mode: t
  paredit-mode: t
  goto-address-prog-mode: t
  origami-mode: t
  savehist-mode: t
  electric-pair-mode: t
  global-auto-revert-mode: t
  mode-line-bell-mode: t
  beacon-mode: t
  show-paren-mode: t
  global-page-break-lines-mode: t
  page-break-lines-mode: t
  hes-mode: t
  guide-key-mode: t
  global-whitespace-cleanup-mode: t
  whitespace-cleanup-mode: t
  global-diff-hl-mode: t
  diff-hl-mode: t
  diff-auto-refine-mode: t
  projectile-rails-global-mode: t
  projectile-mode: t
  ipretty-mode: t
  auto-compile-on-load-mode: t
  auto-compile-on-save-mode: t
  auto-compile-mode: t
  immortal-scratch-mode: t
  nyan-mode: t
  shell-dirtrack-mode: t
  whole-line-or-region-global-mode: t
  whole-line-or-region-local-mode: t
  dimmer-mode: t
  delete-selection-mode: t
  cua-mode: t
  desktop-save-mode: t
  ns-auto-titlebar-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  prettify-symbols-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  view-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail disass align two-column
iso-transl help-fns cl-print debug backtrace autoload radix-tree
tar-mode mm-archive gnutls network-stream url-cache skeleton smex
move-dup misearch multi-isearch mc-mark-more multiple-cursors-core rect
wgrep magit-extras magit-bookmark magit-submodule magit-obsolete
magit-blame magit-stash magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log magit-diff magit-core magit-autorevert magit-process
magit-margin magit-mode git-commit magit-git magit-section magit-utils
magit-popup which-func ido crm log-edit pcvs-util add-log with-editor
async-bytecomp async bookmark cus-edit default-text-scale recentf
tree-widget company-quickhelp pos-tip winner mhtml-mode prettier-js
cursor-sensor mmm-sample org-rmail org-mhe org-irc org-info org-gnus
nnir gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range message rfc822
mml mml-sec epa epg mm-decode mm-bodies mm-encode mailabbrev gmm-utils
mailheader gnus-win org-docview doc-view image-mode org-bibtex bibtex
org-bbdb org-w3m org-element avl-tree ob-sqlite ob-shell ob-ruby
ob-python ob-plantuml ob-octave ob-ledger ob-latex ob-gnuplot ob-dot
ob-ditaa ob-R org-clock org org-macro org-footnote org-pcomplete
org-list org-faces org-entities org-version ob-emacs-lisp ob ob-tangle
org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval
org-compat org-macs org-loaddefs cal-menu calendar cal-loaddefs
company-robe rspec-mode yard-mode robe url-http url-auth mail-parse
rfc2231 url-gw nsm rmc cap-words superword subword dante lcr haskell
haskell-completions haskell-load haskell-commands highlight-uses-mode
haskell-modules haskell-sandbox haskell-navigate-imports haskell-repl
haskell-svg haskell-collapse hideshow haskell-debug
haskell-interactive-mode haskell-presentation-mode haskell-compile
haskell-process haskell-session haskell-hoogle hindent skewer-css
skewer-mode cache-table js2-imenu-extras js2-mode simple-httpd css-eldoc
css-eldoc-hash-table css-mode eww mm-url gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums time-date mail-utils wid-edit
url-queue shr text-property-search puny svg browse-url flycheck-elm
elm-mode elm-interactive url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap
elm-font-lock elm-indent elm-imenu elm-format elm-tags elm-util
inf-haskell haskell-decl-scan haskell-mode haskell-cabal haskell-utils
haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme haskell-align-imports haskell-compat
haskell-complete-module haskell-ghc-support flymake-proc flymake
warnings haskell-customize sh-script executable company-terraform
company-terraform-data terraform-mode hcl-mode make-mode conf-mode
json-mode json-reformat json-snatcher js cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs vc-mtn
vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs diff-hl-dired tabify
perl-mode cperl-mode smerge-mode rainbow-mode dhall-mode reformatter
mmm-mode mmm-univ mmm-class mmm-erb mmm-region tagedit sgml-mode dom
yaml-mode psc-ide psc-ide-flycheck psc-ide-protocol psc-ide-backported
dash-functional purescript-indentation psci add-node-modules-path
purescript-font-lock purescript-mode purescript-string
purescript-sort-imports purescript-align-imports noutline outline
dabbrev view anzu counsel xdg diredfl dired dired-loaddefs swiper ivy
colir ivy-overlay ffap flycheck-color-mode-line flycheck-package
package-lint imenu finder lisp-mnt flycheck find-func let-alist
company-oddmuse company-keywords company-etags company-gtags
company-dabbrev-code company-dabbrev company-files company-capf
company-cmake company-xcode company-clang company-bbdb company-php
company-template ac-php-core popup company-nixos-options nixos-options
company pcase disp-table vc-git vc-darcs xml elisp-slime-nav etags
fileloop generator xref project aggressive-indent highlight-quoted
display-line-numbers rainbow-delimiters symbol-overlay bug-reference
paredit-everywhere paredit goto-addr origami origami-parsers savehist
elec-pair autorevert filenotify mode-line-bell beacon paren
page-break-lines highlight-escape-sequences guide-key popwin
whitespace-cleanup-mode whitespace diff-hl vc-dir ewoc vc vc-dispatcher
diff-mode cl-extra help-mode projectile-rails rake f dash s inflections
inf-ruby ruby-mode smie projectile grep compile ibuf-ext ibuffer
ibuffer-loaddefs thingatpt jka-compr ipretty auto-compile packed
immortal-scratch uptimes pp server nyan-mode init init-local
init-locales mm-util mail-prsvr docker-tramp tramp-cache tramp
tramp-loaddefs trampver tramp-compat shell pcomplete comint ansi-color
ring parse-time format-spec advice session
sanityinc-tomorrow-eighties-theme color-theme-sanityinc-tomorrow
diminish whole-line-or-region dimmer subr-x face-remap color cus-load
init-ledger init-dash init-folding init-misc init-common-lisp
init-clojure-cider init-clojure init-slime init-lisp cl-lib-highlight
init-paredit init-nix init-terraform init-docker init-yaml init-toml
init-rust init-sql init-rails init-ruby init-purescript init-elm
init-haskell init-python init-http init-haml init-css init-html
init-nxml init-org init-php init-javascript easy-mmode init-erlang
erlang-start init-csv init-markdown init-textile init-compile
init-projectile init-github init-git init-darcs init-vc init-whitespace
init-editing-utils delsel cua-base init-mmm mmm-auto mmm-vars mmm-utils
mmm-compat init-sessions desktop frameset init-windows windmove
init-company init-hippie-expand init-ivy init-smex init-recentf
init-flycheck init-ibuffer ibuf-macs init-uniquify init-grep
init-isearch init-dired init-gui-frames ns-auto-titlebar init-osx-keys
init-themes init-xterm init-frame-hooks init-exec-path
exec-path-from-shell init-elpa fullframe finder-inf gh-common marshal
eieio-compat rx edmacro kmacro slime-autoloads info package easymenu
epg-config url-handlers url-parse auth-source eieio eieio-core cl-macs
eieio-loaddefs password-cache json map url-vars seq byte-opt bytecomp
byte-compile cconv init-site-lisp cl-seq cl gv cl-loaddefs cl-lib
init-utils init-benchmarking derived tooltip cus-start eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 2422385 377720)
 (symbols 48 73154 813)
 (strings 32 372448 32970)
 (string-bytes 1 12111991)
 (vectors 16 144591)
 (vector-slots 8 2813290 579564)
 (floats 8 2029 6391)
 (intervals 56 160180 9260)
 (buffers 992 148))