GNU bug report logs - #63260
29.0.90; Regression installing/activating packages without autoloads

Previous Next

Package: emacs;

Reported by: Basil Contovounesios <contovob <at> tcd.ie>

Date: Thu, 4 May 2023 10:16:02 UTC

Severity: normal

Merged with 63298

Found in version 29.0.90

Done: Philip Kaludercic <philipk <at> posteo.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 63260 in the body.
You can then email your comments to 63260 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to philipk <at> posteo.net, bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Thu, 04 May 2023 10:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Basil Contovounesios <contovob <at> tcd.ie>:
New bug report received and forwarded. Copy sent to philipk <at> posteo.net, bug-gnu-emacs <at> gnu.org. (Thu, 04 May 2023 10:16:02 GMT) Full text and rfc822 format available.

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

From: Basil Contovounesios <contovob <at> tcd.ie>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.90; Regression installing/activating packages without autoloads
Date: Thu, 04 May 2023 12:15:15 +0200
This change:

  Prevent generating empty autoload files
  dd21003878d 2023-04-30 18:42:58 +0200
  https://git.sv.gnu.org/cgit/emacs.git/commit/?id=dd21003878d

seems to have reintroduced the following issue:

  https://lists.gnu.org/r/emacs-devel/2022-06/msg00563.html

First start Emacs 29 (or 30) with a clean slate:

$ cd "$(mktemp --directory)"
$ export HOME="${PWD}" XDG_CONFIG_HOME="${PWD}/.config"
$ emacs

Then try to install the sicp package (which lacks autoloads) from MELPA:

0. C-x b RET
1. (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
   C-x C-e
2. M-x package-install RET sicp RET
3. C-h e
4. C-M-S-v

Observe that *Messages* contains the line:

  Error loading autoloads:
  (file-missing
   Cannot open load file
   No such file or directory
   /tmp/tmp.5GvMpPatMo/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)

5. M-x toggle-debug-on-error RET
6. M-x package-quickstart-refresh RET

This fails with:

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    insert-file-contents(nil)
    package-quickstart-refresh()
    funcall-interactively(package-quickstart-refresh)
    call-interactively(package-quickstart-refresh record nil)
    command-execute(package-quickstart-refresh record)
    execute-extended-command(nil "package-quickstart-refresh" "package-quick")
    funcall-interactively(execute-extended-command nil
                          "package-quickstart-refresh"
                          "package-quick")
    call-interactively(execute-extended-command nil nil)
    command-execute(execute-extended-command)
  
The file-missing error also appears on subsequent Emacs startup.

Thanks,

-- 
Basil

In GNU Emacs 29.0.90 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2023-05-04 built on blc
Repository revision: dd21003878dadba1e0420269e63e10685d4670a9
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.2 LTS

Configured using:
 'configure CC=gcc-12 'CFLAGS=-Og -ggdb3' --prefix=/home/bic/.local
 --with-program-suffix=-29 --with-file-notification=yes --with-x
 --with-x-toolkit=lucid'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM
LUCID ZLIB

Important settings:
  value of $LC_MONETARY: en_IE.UTF-8
  value of $LC_NUMERIC: en_IE.UTF-8
  value of $LC_TIME: en_IE.UTF-8
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Debugger

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug help-fns cl-print debug backtrace
help-mode find-func compile comint ansi-osc ansi-color ring info
loaddefs-gen lisp-mnt radix-tree tar-mode arc-mode archive-mode cus-edit
pp cus-start cus-load icons wid-edit mm-archive message sendmail
yank-media dired dired-loaddefs rfc822 mml mml-sec epa derived gnus-util
text-property-search time-date mailabbrev gmm-utils mailheader mm-decode
mm-bodies mm-encode mail-utils gnutls network-stream url-cache url-http
url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-gw nsm puny epg rfc6068 epg-config finder-inf package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache
json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs
cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty
make-network-process emacs)

Memory information:
((conses 16 282927 159473)
 (symbols 48 16620 1)
 (strings 32 98218 50117)
 (string-bytes 1 2278870)
 (vectors 16 25526)
 (vector-slots 8 346646 26540)
 (floats 8 46 357)
 (intervals 56 468 3)
 (buffers 984 15))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Thu, 04 May 2023 15:16:03 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: 63260 <at> debbugs.gnu.org
Cc: Basil Contovounesios <contovob <at> tcd.ie>,
 Philip Kaludercic <philipk <at> posteo.net>
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Thu, 04 May 2023 17:15:30 +0200
>>>>> On Thu, 04 May 2023 12:15:15 +0200, Basil Contovounesios via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> said:

    Bug> This change:

    Basil>   Prevent generating empty autoload files
    Basil>   dd21003878d 2023-04-30 18:42:58 +0200
    Basil>   https://git.sv.gnu.org/cgit/emacs.git/commit/?id=dd21003878d

    Basil> seems to have reintroduced the following issue:

    Basil>   https://lists.gnu.org/r/emacs-devel/2022-06/msg00563.html

    Basil> First start Emacs 29 (or 30) with a clean slate:

    Basil> $ cd "$(mktemp --directory)"
    Basil> $ export HOME="${PWD}" XDG_CONFIG_HOME="${PWD}/.config"
    Basil> $ emacs

    Basil> Then try to install the sicp package (which lacks autoloads) from MELPA:

    Basil> 0. C-x b RET
    Basil> 1. (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
    Basil>    C-x C-e
    Basil> 2. M-x package-install RET sicp RET
    Basil> 3. C-h e
    Basil> 4. C-M-S-v

Only when `package-quickstart' is non-nil, right?

How about this:

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 0919ce34448..42d47ed259c 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -4498,7 +4498,8 @@ package-quickstart-refresh
                (pfile (prin1-to-string file)))
           (insert "(let ((load-true-file-name " pfile ")\
 \(load-file-name " pfile "))\n")
-          (insert-file-contents file)
+          (when file
+            (insert-file-contents file))
           ;; Fixup the special #$ reader form and throw away comments.
           (while (re-search-forward "#\\$\\|^;\\(.*\n\\)" nil 'move)
             (unless (ppss-string-terminator (save-match-data (syntax-ppss)))

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Thu, 04 May 2023 16:30:04 GMT) Full text and rfc822 format available.

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

From: Basil Contovounesios <contovob <at> tcd.ie>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 63260 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Thu, 04 May 2023 18:28:47 +0200
Robert Pluim [2023-05-04 17:15 +0200] wrote:

>>>>>> On Thu, 04 May 2023 12:15:15 +0200, Basil Contovounesios via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> said:
>
>     Bug> This change:
>
>     Basil>   Prevent generating empty autoload files
>     Basil>   dd21003878d 2023-04-30 18:42:58 +0200
>     Basil>   https://git.sv.gnu.org/cgit/emacs.git/commit/?id=dd21003878d
>
>     Basil> seems to have reintroduced the following issue:
>
>     Basil>   https://lists.gnu.org/r/emacs-devel/2022-06/msg00563.html
>
>     Basil> First start Emacs 29 (or 30) with a clean slate:
>
>     Basil> $ cd "$(mktemp --directory)"
>     Basil> $ export HOME="${PWD}" XDG_CONFIG_HOME="${PWD}/.config"
>     Basil> $ emacs
>
>     Basil> Then try to install the sicp package (which lacks autoloads) from MELPA:
>
>     Basil> 0. C-x b RET
>     Basil> 1. (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
>     Basil>    C-x C-e
>     Basil> 2. M-x package-install RET sicp RET
>     Basil> 3. C-h e
>     Basil> 4. C-M-S-v
>
> Only when `package-quickstart' is non-nil, right?

No, this is in an empty user-emacs-directory, i.e. with the default
package-quickstart = nil.  Besides, package-quickstart does not come
into play during package-install AFAICT.

> How about this:
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 0919ce34448..42d47ed259c 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -4498,7 +4498,8 @@ package-quickstart-refresh
>                 (pfile (prin1-to-string file)))
>            (insert "(let ((load-true-file-name " pfile ")\
>  \(load-file-name " pfile "))\n")
> -          (insert-file-contents file)
> +          (when file
> +            (insert-file-contents file))

This does not address the file-missing error during package activation,
but it allows a subsequent package-quickstart-refresh to complete
(albeit with a warning in a *Compile-Log*):

  Compiling file /tmp/tmp.6cdF8paE0K/.emacs.d/package-quickstart.el
                 at Thu May  4 18:24:07 2023
  Entering directory ‘/tmp/tmp.6cdF8paE0K/.emacs.d/’
  package-quickstart.el:4:2: Warning: Empty let body

due to the following generated contents of package-quickstart-file:

  (let ((load-true-file-name nil)(load-file-name nil))
  )

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Fri, 05 May 2023 06:38:01 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: Basil Contovounesios <contovob <at> tcd.ie>
Cc: 63260 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Fri, 05 May 2023 08:36:51 +0200
>>>>> On Thu, 04 May 2023 18:28:47 +0200, Basil Contovounesios <contovob <at> tcd.ie> said:

    Basil> Robert Pluim [2023-05-04 17:15 +0200] wrote:
    >>>>>>> On Thu, 04 May 2023 12:15:15 +0200, Basil Contovounesios via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> said:
    >> 
    Bug> This change:
    >> 
    Basil> Prevent generating empty autoload files
    Basil> dd21003878d 2023-04-30 18:42:58 +0200
    Basil> https://git.sv.gnu.org/cgit/emacs.git/commit/?id=dd21003878d
    >> 
    Basil> seems to have reintroduced the following issue:
    >> 
    Basil> https://lists.gnu.org/r/emacs-devel/2022-06/msg00563.html
    >> 
    Basil> First start Emacs 29 (or 30) with a clean slate:
    >> 
    Basil> $ cd "$(mktemp --directory)"
    Basil> $ export HOME="${PWD}" XDG_CONFIG_HOME="${PWD}/.config"
    Basil> $ emacs
    >> 
    Basil> Then try to install the sicp package (which lacks autoloads) from MELPA:
    >> 
    Basil> 0. C-x b RET
    Basil> 1. (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
    Basil> C-x C-e
    Basil> 2. M-x package-install RET sicp RET
    Basil> 3. C-h e
    Basil> 4. C-M-S-v
    >> 
    >> Only when `package-quickstart' is non-nil, right?

    Basil> No, this is in an empty user-emacs-directory, i.e. with the default
    Basil> package-quickstart = nil.  Besides, package-quickstart does not come
    Basil> into play during package-install AFAICT.

Right. My testing was faulty

    Basil> This does not address the file-missing error during package activation,
    Basil> but it allows a subsequent package-quickstart-refresh to complete
    Basil> (albeit with a warning in a *Compile-Log*):

The file-missing error is expected, no? Thatʼs why the autoloads
loading is wrapped in `with-demoted-errors'. Although if the message bothers
you, I guess we could check `file-exists-p' for it.

    Basil>   Compiling file /tmp/tmp.6cdF8paE0K/.emacs.d/package-quickstart.el
    Basil>                  at Thu May  4 18:24:07 2023
    Basil>   Entering directory ‘/tmp/tmp.6cdF8paE0K/.emacs.d/’
    Basil>   package-quickstart.el:4:2: Warning: Empty let body

    Basil> due to the following generated contents of package-quickstart-file:

    Basil>   (let ((load-true-file-name nil)(load-file-name nil))
    Basil>   )

Iʼd claim ENOCOFFEE for the last patch, but it was not the morning :-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 0919ce34448..4b488281b78 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -4491,11 +4491,11 @@ package-quickstart-refresh
       (insert ";;; Quickstart file to activate all packages at startup  -*- lexical-binding:t -*-\n")
       (insert ";; ¡¡ This file is autogenerated by `package-quickstart-refresh', DO NOT EDIT !!\n\n")
       (dolist (pkg package--quickstart-pkgs)
-        (let* ((file
-                ;; Prefer uncompiled files (and don't accept .so files).
-                (let ((load-suffixes '(".el" ".elc")))
-                  (locate-library (package--autoloads-file-name pkg))))
-               (pfile (prin1-to-string file)))
+        (when-let* ((file
+                     ;; Prefer uncompiled files (and don't accept .so files).
+                     (let ((load-suffixes '(".el" ".elc")))
+                       (locate-library (package--autoloads-file-name pkg))))
+                    (pfile (prin1-to-string file)))
           (insert "(let ((load-true-file-name " pfile ")\
 \(load-file-name " pfile "))\n")
           (insert-file-contents file)


Robert
-- 




Merged 63260 63298. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 05 May 2023 11:01:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sat, 06 May 2023 09:01:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: contovob <at> tcd.ie, 63260 <at> debbugs.gnu.org, philipk <at> posteo.net
Subject: Re: bug#63260: 29.0.90;
 Regression installing/activating packages without autoloads
Date: Sat, 06 May 2023 12:01:07 +0300
> Cc: 63260 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>
> From: Robert Pluim <rpluim <at> gmail.com>
> Date: Fri, 05 May 2023 08:36:51 +0200
> 
> >>>>> On Thu, 04 May 2023 18:28:47 +0200, Basil Contovounesios <contovob <at> tcd.ie> said:
> 
>     Basil> This does not address the file-missing error during package activation,
>     Basil> but it allows a subsequent package-quickstart-refresh to complete
>     Basil> (albeit with a warning in a *Compile-Log*):
> 
> The file-missing error is expected, no? Thatʼs why the autoloads
> loading is wrapped in `with-demoted-errors'. Although if the message bothers
> you, I guess we could check `file-exists-p' for it.
> 
>     Basil>   Compiling file /tmp/tmp.6cdF8paE0K/.emacs.d/package-quickstart.el
>     Basil>                  at Thu May  4 18:24:07 2023
>     Basil>   Entering directory ‘/tmp/tmp.6cdF8paE0K/.emacs.d/’
>     Basil>   package-quickstart.el:4:2: Warning: Empty let body
> 
>     Basil> due to the following generated contents of package-quickstart-file:
> 
>     Basil>   (let ((load-true-file-name nil)(load-file-name nil))
>     Basil>   )
> 
> Iʼd claim ENOCOFFEE for the last patch, but it was not the morning :-)
> 
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 0919ce34448..4b488281b78 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -4491,11 +4491,11 @@ package-quickstart-refresh
>        (insert ";;; Quickstart file to activate all packages at startup  -*- lexical-binding:t -*-\n")
>        (insert ";; ¡¡ This file is autogenerated by `package-quickstart-refresh', DO NOT EDIT !!\n\n")
>        (dolist (pkg package--quickstart-pkgs)
> -        (let* ((file
> -                ;; Prefer uncompiled files (and don't accept .so files).
> -                (let ((load-suffixes '(".el" ".elc")))
> -                  (locate-library (package--autoloads-file-name pkg))))
> -               (pfile (prin1-to-string file)))
> +        (when-let* ((file
> +                     ;; Prefer uncompiled files (and don't accept .so files).
> +                     (let ((load-suffixes '(".el" ".elc")))
> +                       (locate-library (package--autoloads-file-name pkg))))
> +                    (pfile (prin1-to-string file)))
>            (insert "(let ((load-true-file-name " pfile ")\
>  \(load-file-name " pfile "))\n")
>            (insert-file-contents file)
> 

Philip, Basil: is the above okay with you?  I'd like this issue
resolved before making the next pretest of Emacs 29.1.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sat, 06 May 2023 12:52:02 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, 63260 <at> debbugs.gnu.org,
 "Philip K." <philipk <at> posteo.net>
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sat, 6 May 2023 14:51:39 +0200
[Message part 1 (text/plain, inline)]
Please push if it's ok with you, I'm afk until tomorrow

Thanks

Robert

On Sat, May 6, 2023, 11:00 Eli Zaretskii <eliz <at> gnu.org> wrote:

> > Cc: 63260 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>
> > From: Robert Pluim <rpluim <at> gmail.com>
> > Date: Fri, 05 May 2023 08:36:51 +0200
> >
> > >>>>> On Thu, 04 May 2023 18:28:47 +0200, Basil Contovounesios <
> contovob <at> tcd.ie> said:
> >
> >     Basil> This does not address the file-missing error during package
> activation,
> >     Basil> but it allows a subsequent package-quickstart-refresh to
> complete
> >     Basil> (albeit with a warning in a *Compile-Log*):
> >
> > The file-missing error is expected, no? Thatʼs why the autoloads
> > loading is wrapped in `with-demoted-errors'. Although if the message
> bothers
> > you, I guess we could check `file-exists-p' for it.
> >
> >     Basil>   Compiling file
> /tmp/tmp.6cdF8paE0K/.emacs.d/package-quickstart.el
> >     Basil>                  at Thu May  4 18:24:07 2023
> >     Basil>   Entering directory ‘/tmp/tmp.6cdF8paE0K/.emacs.d/’
> >     Basil>   package-quickstart.el:4:2: Warning: Empty let body
> >
> >     Basil> due to the following generated contents of
> package-quickstart-file:
> >
> >     Basil>   (let ((load-true-file-name nil)(load-file-name nil))
> >     Basil>   )
> >
> > Iʼd claim ENOCOFFEE for the last patch, but it was not the morning :-)
> >
> > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> > index 0919ce34448..4b488281b78 100644
> > --- a/lisp/emacs-lisp/package.el
> > +++ b/lisp/emacs-lisp/package.el
> > @@ -4491,11 +4491,11 @@ package-quickstart-refresh
> >        (insert ";;; Quickstart file to activate all packages at startup
> -*- lexical-binding:t -*-\n")
> >        (insert ";; ¡¡ This file is autogenerated by
> `package-quickstart-refresh', DO NOT EDIT !!\n\n")
> >        (dolist (pkg package--quickstart-pkgs)
> > -        (let* ((file
> > -                ;; Prefer uncompiled files (and don't accept .so files).
> > -                (let ((load-suffixes '(".el" ".elc")))
> > -                  (locate-library (package--autoloads-file-name pkg))))
> > -               (pfile (prin1-to-string file)))
> > +        (when-let* ((file
> > +                     ;; Prefer uncompiled files (and don't accept .so
> files).
> > +                     (let ((load-suffixes '(".el" ".elc")))
> > +                       (locate-library (package--autoloads-file-name
> pkg))))
> > +                    (pfile (prin1-to-string file)))
> >            (insert "(let ((load-true-file-name " pfile ")\
> >  \(load-file-name " pfile "))\n")
> >            (insert-file-contents file)
> >
>
> Philip, Basil: is the above okay with you?  I'd like this issue
> resolved before making the next pretest of Emacs 29.1.
>
> Thanks.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sat, 06 May 2023 13:11:01 GMT) Full text and rfc822 format available.

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

From: Basil Contovounesios <contovob <at> tcd.ie>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 63260 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sat, 06 May 2023 15:10:23 +0200
Robert Pluim [2023-05-05 08:36 +0200] wrote:

>>>>>> On Thu, 04 May 2023 18:28:47 +0200, Basil Contovounesios <contovob <at> tcd.ie> said:
>
>     Basil> This does not address the file-missing error during package activation,
>     Basil> but it allows a subsequent package-quickstart-refresh to complete
>     Basil> (albeit with a warning in a *Compile-Log*):
>
> The file-missing error is expected, no? Thatʼs why the autoloads
> loading is wrapped in `with-demoted-errors'. Although if the message bothers
> you, I guess we could check `file-exists-p' for it.

I think it's problematic to emit even a demoted error for supported
circumstances, such as a 'library' package that defines no autoload
cookies.

Besides, shouldn't the autoloads file be generated unconditionally?
https://lists.gnu.org/r/emacs-devel/2022-06/msg00570.html

While the error logged to *Messages* is relatively silent, its subequent
repetition on Emacs startup is not:

$ emacs-29
Error loading autoloads: (file-missing Cannot open load file
No such file or directory
/tmp/tmp.QQvQfBZ384/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)

This does not seem like TRT to me.

>     Basil>   Compiling file /tmp/tmp.6cdF8paE0K/.emacs.d/package-quickstart.el
>     Basil>                  at Thu May  4 18:24:07 2023
>     Basil>   Entering directory ‘/tmp/tmp.6cdF8paE0K/.emacs.d/’
>     Basil>   package-quickstart.el:4:2: Warning: Empty let body
>
>     Basil> due to the following generated contents of package-quickstart-file:
>
>     Basil>   (let ((load-true-file-name nil)(load-file-name nil))
>     Basil>   )
>
> Iʼd claim ENOCOFFEE for the last patch, but it was not the morning :-)

If only POSIX made it clear to expect ENOCOFFEE when it's least
expected ;).

> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 0919ce34448..4b488281b78 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -4491,11 +4491,11 @@ package-quickstart-refresh
>        (insert ";;; Quickstart file to activate all packages at startup  -*- lexical-binding:t -*-\n")
>        (insert ";; ¡¡ This file is autogenerated by `package-quickstart-refresh', DO NOT EDIT !!\n\n")
>        (dolist (pkg package--quickstart-pkgs)
> -        (let* ((file
> -                ;; Prefer uncompiled files (and don't accept .so files).
> -                (let ((load-suffixes '(".el" ".elc")))
> -                  (locate-library (package--autoloads-file-name pkg))))
> -               (pfile (prin1-to-string file)))
> +        (when-let* ((file
> +                     ;; Prefer uncompiled files (and don't accept .so files).
> +                     (let ((load-suffixes '(".el" ".elc")))
> +                       (locate-library (package--autoloads-file-name pkg))))
> +                    (pfile (prin1-to-string file)))
>            (insert "(let ((load-true-file-name " pfile ")\
>  \(load-file-name " pfile "))\n")
>            (insert-file-contents file)

This indeed avoids the problem in package-quickstart, thanks.

The issue with the missing autoload file during package
installation/activation remains, however.

Sorry for not being more helpful, but I'm travelling until next week.

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sat, 06 May 2023 13:13:02 GMT) Full text and rfc822 format available.

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

From: Basil Contovounesios <contovob <at> tcd.ie>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63260 <at> debbugs.gnu.org, Robert Pluim <rpluim <at> gmail.com>, philipk <at> posteo.net
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sat, 06 May 2023 15:12:31 +0200
Eli Zaretskii [2023-05-06 05:00 -0400] wrote:

>> Cc: 63260 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>
>> From: Robert Pluim <rpluim <at> gmail.com>
>> Date: Fri, 05 May 2023 08:36:51 +0200
>> 
>> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
>> index 0919ce34448..4b488281b78 100644
>> --- a/lisp/emacs-lisp/package.el
>> +++ b/lisp/emacs-lisp/package.el
>> @@ -4491,11 +4491,11 @@ package-quickstart-refresh
>>        (insert ";;; Quickstart file to activate all packages at startup  -*- lexical-binding:t -*-\n")
>>        (insert ";; ¡¡ This file is autogenerated by `package-quickstart-refresh', DO NOT EDIT !!\n\n")
>>        (dolist (pkg package--quickstart-pkgs)
>> -        (let* ((file
>> -                ;; Prefer uncompiled files (and don't accept .so files).
>> -                (let ((load-suffixes '(".el" ".elc")))
>> -                  (locate-library (package--autoloads-file-name pkg))))
>> -               (pfile (prin1-to-string file)))
>> +        (when-let* ((file
>> +                     ;; Prefer uncompiled files (and don't accept .so files).
>> +                     (let ((load-suffixes '(".el" ".elc")))
>> +                       (locate-library (package--autoloads-file-name pkg))))
>> +                    (pfile (prin1-to-string file)))
>>            (insert "(let ((load-true-file-name " pfile ")\
>>  \(load-file-name " pfile "))\n")
>>            (insert-file-contents file)
>
> Philip, Basil: is the above okay with you?  I'd like this issue
> resolved before making the next pretest of Emacs 29.1.

As I said in my other message, AFAICT this fixes a symptom specific to
package-quickstart of the more general autoload file problem
reintroduced by dd21003878d.

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sat, 06 May 2023 13:23:03 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Basil Contovounesios <contovob <at> tcd.ie>
Cc: 63260 <at> debbugs.gnu.org, rpluim <at> gmail.com, philipk <at> posteo.net
Subject: Re: bug#63260: 29.0.90;
 Regression installing/activating packages without autoloads
Date: Sat, 06 May 2023 16:23:43 +0300
> Cc: 63260 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>
> Date: Sat, 06 May 2023 15:10:23 +0200
> From:  Basil Contovounesios via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Robert Pluim [2023-05-05 08:36 +0200] wrote:
> 
> > The file-missing error is expected, no? Thatʼs why the autoloads
> > loading is wrapped in `with-demoted-errors'. Although if the message bothers
> > you, I guess we could check `file-exists-p' for it.
> 
> I think it's problematic to emit even a demoted error for supported
> circumstances, such as a 'library' package that defines no autoload
> cookies.
> 
> Besides, shouldn't the autoloads file be generated unconditionally?
> https://lists.gnu.org/r/emacs-devel/2022-06/msg00570.html
> 
> While the error logged to *Messages* is relatively silent, its subequent
> repetition on Emacs startup is not:
> 
> $ emacs-29
> Error loading autoloads: (file-missing Cannot open load file
> No such file or directory
> /tmp/tmp.QQvQfBZ384/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)
> 
> This does not seem like TRT to me.

What happened in Emacs 28 in the same situation?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sat, 06 May 2023 13:29:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Basil Contovounesios <contovob <at> tcd.ie>
Cc: 63260 <at> debbugs.gnu.org, rpluim <at> gmail.com, philipk <at> posteo.net
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sat, 06 May 2023 16:28:51 +0300
> From: Basil Contovounesios <contovob <at> tcd.ie>
> Cc: Robert Pluim <rpluim <at> gmail.com>,  63260 <at> debbugs.gnu.org,
>   philipk <at> posteo.net
> Date: Sat, 06 May 2023 15:12:31 +0200
> 
> > Philip, Basil: is the above okay with you?  I'd like this issue
> > resolved before making the next pretest of Emacs 29.1.
> 
> As I said in my other message, AFAICT this fixes a symptom specific to
> package-quickstart of the more general autoload file problem
> reintroduced by dd21003878d.

I'm trying to find a solution that is less drastic than reverting
commit dd21003878d.  Please help me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sun, 07 May 2023 09:47:02 GMT) Full text and rfc822 format available.

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

From: Basil Contovounesios <contovob <at> tcd.ie>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63260 <at> debbugs.gnu.org, rpluim <at> gmail.com, philipk <at> posteo.net
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sun, 07 May 2023 11:46:29 +0200
[Message part 1 (text/plain, inline)]
Eli Zaretskii [2023-05-06 16:23 +0300] wrote:

>> Cc: 63260 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>
>> Date: Sat, 06 May 2023 15:10:23 +0200
>> From:  Basil Contovounesios via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>> Robert Pluim [2023-05-05 08:36 +0200] wrote:
>> 
>> > The file-missing error is expected, no? Thatʼs why the autoloads
>> > loading is wrapped in `with-demoted-errors'. Although if the message bothers
>> > you, I guess we could check `file-exists-p' for it.
>> 
>> I think it's problematic to emit even a demoted error for supported
>> circumstances, such as a 'library' package that defines no autoload
>> cookies.
>> 
>> Besides, shouldn't the autoloads file be generated unconditionally?
>> https://lists.gnu.org/r/emacs-devel/2022-06/msg00570.html
>> 
>> While the error logged to *Messages* is relatively silent, its subequent
>> repetition on Emacs startup is not:
>> 
>> $ emacs-29
>> Error loading autoloads: (file-missing Cannot open load file
>> No such file or directory
>> /tmp/tmp.QQvQfBZ384/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)
>> 
>> This does not seem like TRT to me.
>
> What happened in Emacs 28 in the same situation?

Emacs 28.2 installs and activates the sicp package without complaints,
and generates the following -autoloads.el file, as expected:

[sicp-autoloads.el (application/emacs-lisp, inline)]
[Message part 3 (text/plain, inline)]
The current emacs-29 generates no such autoloads file, because the sicp
package defines no autoloads.  But in general the -autoloads.el file is
nevertheless needed, at least for its load-path logic.

Contrast this with a package that defines even a single autoload cookie,
such as the bluetooth package on GNU ELPA.  In this case emacs-29 does
TRT:

[bluetooth-autoloads.el (application/emacs-lisp, inline)]
[Message part 5 (text/plain, inline)]
-- 
Basil

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sun, 07 May 2023 10:51:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Basil Contovounesios <contovob <at> tcd.ie>, philipk <at> posteo.net
Cc: 63260 <at> debbugs.gnu.org, rpluim <at> gmail.com
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sun, 07 May 2023 13:50:49 +0300
> From: Basil Contovounesios <contovob <at> tcd.ie>
> Cc: 63260 <at> debbugs.gnu.org,  rpluim <at> gmail.com,  philipk <at> posteo.net
> Date: Sun, 07 May 2023 11:46:29 +0200
> 
> >> While the error logged to *Messages* is relatively silent, its subequent
> >> repetition on Emacs startup is not:
> >> 
> >> $ emacs-29
> >> Error loading autoloads: (file-missing Cannot open load file
> >> No such file or directory
> >> /tmp/tmp.QQvQfBZ384/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)
> >> 
> >> This does not seem like TRT to me.
> >
> > What happened in Emacs 28 in the same situation?
> 
> Emacs 28.2 installs and activates the sicp package without complaints,
> and generates the following -autoloads.el file, as expected:
> 
> 
> The current emacs-29 generates no such autoloads file, because the sicp
> package defines no autoloads.  But in general the -autoloads.el file is
> nevertheless needed, at least for its load-path logic.

AFAIU, in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62734 I asked
Philip what would happen in this case, and he replied that the changes
he proposed did TRT in that case?  So what is different here?  Philip?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sun, 07 May 2023 11:00:02 GMT) Full text and rfc822 format available.

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

From: Basil Contovounesios <contovob <at> tcd.ie>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63260 <at> debbugs.gnu.org, rpluim <at> gmail.com, philipk <at> posteo.net
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sun, 07 May 2023 12:59:32 +0200
Eli Zaretskii [2023-05-06 09:28 -0400] wrote:

>> From: Basil Contovounesios <contovob <at> tcd.ie>
>> Cc: Robert Pluim <rpluim <at> gmail.com>,  63260 <at> debbugs.gnu.org,
>>   philipk <at> posteo.net
>> Date: Sat, 06 May 2023 15:12:31 +0200
>> 
>> > Philip, Basil: is the above okay with you?  I'd like this issue
>> > resolved before making the next pretest of Emacs 29.1.
>> 
>> As I said in my other message, AFAICT this fixes a symptom specific to
>> package-quickstart of the more general autoload file problem
>> reintroduced by dd21003878d.
>
> I'm trying to find a solution that is less drastic than reverting
> commit dd21003878d.  Please help me.

I would like to, but I'm unfamiliar with loaddefs-gen and what Philip's
change was addressing.  I'll need some time to understand and test
what's going on.  Unfortunately I'm only very sporadically at a keyboard
until at least tomorrow evening.  Hopefully Philip or Robert can beat me
to it, otherwise I hope to have a look in the coming days.

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sun, 07 May 2023 12:40:02 GMT) Full text and rfc822 format available.

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

From: Philip Kaludercic <philipk <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Basil Contovounesios <contovob <at> tcd.ie>, 63260 <at> debbugs.gnu.org,
 rpluim <at> gmail.com
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sun, 07 May 2023 12:39:48 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Basil Contovounesios <contovob <at> tcd.ie>
>> Cc: 63260 <at> debbugs.gnu.org,  rpluim <at> gmail.com,  philipk <at> posteo.net
>> Date: Sun, 07 May 2023 11:46:29 +0200
>> 
>> >> While the error logged to *Messages* is relatively silent, its subequent
>> >> repetition on Emacs startup is not:
>> >> 
>> >> $ emacs-29
>> >> Error loading autoloads: (file-missing Cannot open load file
>> >> No such file or directory
>> >> /tmp/tmp.QQvQfBZ384/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)
>> >> 
>> >> This does not seem like TRT to me.
>> >
>> > What happened in Emacs 28 in the same situation?
>> 
>> Emacs 28.2 installs and activates the sicp package without complaints,
>> and generates the following -autoloads.el file, as expected:
>> 
>> 
>> The current emacs-29 generates no such autoloads file, because the sicp
>> package defines no autoloads.  But in general the -autoloads.el file is
>> nevertheless needed, at least for its load-path logic.
>
> AFAIU, in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62734 I asked
> Philip what would happen in this case, and he replied that the changes
> he proposed did TRT in that case?  So what is different here?  Philip?

No, that appears to have been my mistake.  The issue is that
`loaddefs-generate' generates the autoload file while looping over all
definitions to autoload, but if there are no files, Basil is right that
nothing happens.  This is fine in general, but `loaddefs-generate' has
the extra task of modifying load-path (which has been the root of the
issue in bug#62734).  Perhaps it is best to revert the commit, and come
up with a alternative solution.  I have an idea, but I'll have to test
it again before I forget something like this.

-- 
Philip Kaludercic




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sun, 07 May 2023 12:54:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: contovob <at> tcd.ie, 63260 <at> debbugs.gnu.org, rpluim <at> gmail.com
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sun, 07 May 2023 15:54:28 +0300
> From: Philip Kaludercic <philipk <at> posteo.net>
> Cc: Basil Contovounesios <contovob <at> tcd.ie>,  63260 <at> debbugs.gnu.org,
>   rpluim <at> gmail.com
> Date: Sun, 07 May 2023 12:39:48 +0000
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > AFAIU, in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62734 I asked
> > Philip what would happen in this case, and he replied that the changes
> > he proposed did TRT in that case?  So what is different here?  Philip?
> 
> No, that appears to have been my mistake.  The issue is that
> `loaddefs-generate' generates the autoload file while looping over all
> definitions to autoload, but if there are no files, Basil is right that
> nothing happens.  This is fine in general, but `loaddefs-generate' has
> the extra task of modifying load-path (which has been the root of the
> issue in bug#62734).  Perhaps it is best to revert the commit, and come
> up with a alternative solution.  I have an idea, but I'll have to test
> it again before I forget something like this.

If we revert that commit, we will bring back bug#62734, which to me
sounds like a similarly serious, perhaps even more serious, issue,
don't you agree?  So I think maybe we need to amend that commit with
something that takes care of the particular situation reported here.
Specifically, it seems we need to detect the situation where a package
has no autoloads at all, and then produce the minimal autoloads file
that such packages expect.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sun, 07 May 2023 13:14:02 GMT) Full text and rfc822 format available.

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

From: Philip Kaludercic <philipk <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: contovob <at> tcd.ie, 63260 <at> debbugs.gnu.org, rpluim <at> gmail.com
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sun, 07 May 2023 13:12:47 +0000
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Philip Kaludercic <philipk <at> posteo.net>
>> Cc: Basil Contovounesios <contovob <at> tcd.ie>,  63260 <at> debbugs.gnu.org,
>>   rpluim <at> gmail.com
>> Date: Sun, 07 May 2023 12:39:48 +0000
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> > AFAIU, in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62734 I asked
>> > Philip what would happen in this case, and he replied that the changes
>> > he proposed did TRT in that case?  So what is different here?  Philip?
>> 
>> No, that appears to have been my mistake.  The issue is that
>> `loaddefs-generate' generates the autoload file while looping over all
>> definitions to autoload, but if there are no files, Basil is right that
>> nothing happens.  This is fine in general, but `loaddefs-generate' has
>> the extra task of modifying load-path (which has been the root of the
>> issue in bug#62734).  Perhaps it is best to revert the commit, and come
>> up with a alternative solution.  I have an idea, but I'll have to test
>> it again before I forget something like this.
>
> If we revert that commit, we will bring back bug#62734, which to me
> sounds like a similarly serious, perhaps even more serious, issue,
> don't you agree?  

My idea was that we could revert the commit, and then install a smaller
change, basically just replacing the condition

  (and (not defs) extra-data)

with

  (not defs)

but thinking about it for a bit, I noticed that you are right that this
would just re-introduce the same issue.

>                   So I think maybe we need to amend that commit with
> something that takes care of the particular situation reported here.
> Specifically, it seems we need to detect the situation where a package
> has no autoloads at all, and then produce the minimal autoloads file
> that such packages expect.

One hack might just be to check if `loaddefs-generate' has generated
anything at all or not, and if that is not the case to do so manually in
package.el.  The reason this doesn't seem nice, is that we'd have to
make the fact that `loaddefs-generate' does not generate a OUTPUT-FILE
if there is no file with autoloads explicit, and finding a justification
for that is difficult.  Alternatively, this could be done inside of
`loaddefs-generate'?  Something like

[Message part 2 (text/plain, inline)]
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 2a46fb7a022..c23f21553d5 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -656,7 +656,17 @@ loaddefs-generate
             (write-region (point-min) (point-max) loaddefs-file nil 'silent)
             (byte-compile-info
              (file-relative-name loaddefs-file (car (ensure-list dir)))
-             t "GEN")))))))
+             t "GEN")))))
+
+    ;; HACK: If no file with autoloads were found, but EXTRA-DATA was
+    ;; passed, we still want to generate a file.
+    (unless (and extra-data (file-exists-p output-file))
+      (with-temp-buffer
+        (insert (loaddefs-generate--rubric output-file nil t))
+        (search-backward "\f")
+        (insert extra-data)
+        (ensure-empty-lines 1)
+        (write-region (point-min) (point-max) output-file nil 'silent)))))
 
 (defun loaddefs-generate--print-form (def)
   "Print DEF in a format that makes sense for version control."
[Message part 3 (text/plain, inline)]
-- 
Philip Kaludercic

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sun, 07 May 2023 13:21:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: contovob <at> tcd.ie, 63260 <at> debbugs.gnu.org, rpluim <at> gmail.com
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sun, 07 May 2023 16:21:01 +0300
> From: Philip Kaludercic <philipk <at> posteo.net>
> Cc: contovob <at> tcd.ie,  63260 <at> debbugs.gnu.org,  rpluim <at> gmail.com
> Date: Sun, 07 May 2023 13:12:47 +0000
> 
> One hack might just be to check if `loaddefs-generate' has generated
> anything at all or not, and if that is not the case to do so manually in
> package.el.  The reason this doesn't seem nice, is that we'd have to
> make the fact that `loaddefs-generate' does not generate a OUTPUT-FILE
> if there is no file with autoloads explicit, and finding a justification
> for that is difficult.  Alternatively, this could be done inside of
> `loaddefs-generate'?  Something like

Assuming it solves the issue and doesn't break anything, the latter
sounds good to me, better than the alternatives.

> +    ;; HACK: If no file with autoloads were found, but EXTRA-DATA was
> +    ;; passed, we still want to generate a file.

The comment says "EXTRA-DATA was passed", but this added snipped will
also run if EXTRA-DATA was NOT passed, but the OUTPUT-FILE doesn't
exist, right?

And I would explain in the comment the real-life situations where this
is needed, and why, rather than just explaining in English what the
code does.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Sun, 07 May 2023 19:38:02 GMT) Full text and rfc822 format available.

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

From: Philip Kaludercic <philipk <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: contovob <at> tcd.ie, 63260 <at> debbugs.gnu.org, rpluim <at> gmail.com
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Sun, 07 May 2023 19:37:26 +0000
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Philip Kaludercic <philipk <at> posteo.net>
>> Cc: contovob <at> tcd.ie,  63260 <at> debbugs.gnu.org,  rpluim <at> gmail.com
>> Date: Sun, 07 May 2023 13:12:47 +0000
>> 
>> One hack might just be to check if `loaddefs-generate' has generated
>> anything at all or not, and if that is not the case to do so manually in
>> package.el.  The reason this doesn't seem nice, is that we'd have to
>> make the fact that `loaddefs-generate' does not generate a OUTPUT-FILE
>> if there is no file with autoloads explicit, and finding a justification
>> for that is difficult.  Alternatively, this could be done inside of
>> `loaddefs-generate'?  Something like
>
> Assuming it solves the issue and doesn't break anything, the latter
> sounds good to me, better than the alternatives.
>
>> +    ;; HACK: If no file with autoloads were found, but EXTRA-DATA was
>> +    ;; passed, we still want to generate a file.
>
> The comment says "EXTRA-DATA was passed", but this added snipped will
> also run if EXTRA-DATA was NOT passed, but the OUTPUT-FILE doesn't
> exist, right?

Right, the code was not tested as I was in a hurry.  I've changed it to

    ;; HACK: If no file with autoloads were found, but EXTRA-DATA was
    ;; passed, we still want to generate a file.
    (when (and extra-data (not (file-exists-p output-file)))


and this file is generated when installing the SICP package:

--8<---------------cut here---------------start------------->8---
;;; sicp-autoloads.el --- automatically extracted autoloads (do not edit)   -*- lexical-binding: t -*-
;; Generated by the `loaddefs-generate' function.

;; This file is part of GNU Emacs.

;;; Code:

(add-to-list 'load-path (or (and load-file-name (file-name-directory load-file-name)) (car load-path)))


;;; End of scraped data

(provide 'sicp-autoloads)

;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; no-native-compile: t
;; coding: utf-8-emacs-unix
;; End:

;;; sicp-autoloads.el ends here
--8<---------------cut here---------------end--------------->8---

and this does not break anything when installing packages.

> And I would explain in the comment the real-life situations where this
> is needed, and why, rather than just explaining in English what the
> code does.

You are right.  How does this patch look like:

[0001-Ensure-that-EXTRA-DATA-are-always-written-when-gener.patch (text/x-diff, inline)]
From 08c914abaa37bfb1f84ca7a357cc6e01ccfd254f Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk <at> posteo.net>
Date: Sun, 7 May 2023 21:37:01 +0200
Subject: [PATCH] Ensure that EXTRA-DATA are always written when generating
 autoloads

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Handle
edge-case where no autoloads are found.  (Bug#63260)
---
 lisp/emacs-lisp/loaddefs-gen.el | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 2a46fb7a022..5db9af21508 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -656,7 +656,20 @@ loaddefs-generate
             (write-region (point-min) (point-max) loaddefs-file nil 'silent)
             (byte-compile-info
              (file-relative-name loaddefs-file (car (ensure-list dir)))
-             t "GEN")))))))
+             t "GEN")))))
+
+    ;; If processing files without any autoloads, the above loop will
+    ;; not generate any files.  If the function was invoked with
+    ;; EXTRA-DATA, we want to ensure that even if no autoloads were
+    ;; found, that at least a file will have been generated containing
+    ;; the contents of EXTRA-DATA:
+    (when (and extra-data (not (file-exists-p output-file)))
+      (with-temp-buffer
+        (insert (loaddefs-generate--rubric output-file nil t))
+        (search-backward "\f")
+        (insert extra-data)
+        (ensure-empty-lines 1)
+        (write-region (point-min) (point-max) output-file nil 'silent)))))
 
 (defun loaddefs-generate--print-form (def)
   "Print DEF in a format that makes sense for version control."
-- 
2.39.2

[Message part 3 (text/plain, inline)]
> Thanks.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Mon, 08 May 2023 11:16:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: contovob <at> tcd.ie, 63260 <at> debbugs.gnu.org, rpluim <at> gmail.com
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Mon, 08 May 2023 14:16:49 +0300
> From: Philip Kaludercic <philipk <at> posteo.net>
> Cc: contovob <at> tcd.ie,  63260 <at> debbugs.gnu.org,  rpluim <at> gmail.com
> Date: Sun, 07 May 2023 19:37:26 +0000
> 
> and this file is generated when installing the SICP package:
> 
> --8<---------------cut here---------------start------------->8---
> ;;; sicp-autoloads.el --- automatically extracted autoloads (do not edit)   -*- lexical-binding: t -*-
> ;; Generated by the `loaddefs-generate' function.
> 
> ;; This file is part of GNU Emacs.
> 
> ;;; Code:
> 
> (add-to-list 'load-path (or (and load-file-name (file-name-directory load-file-name)) (car load-path)))
> 
> 
> ;;; End of scraped data
> 
> (provide 'sicp-autoloads)
> 
> ;; Local Variables:
> ;; version-control: never
> ;; no-byte-compile: t
> ;; no-update-autoloads: t
> ;; no-native-compile: t
> ;; coding: utf-8-emacs-unix
> ;; End:
> 
> ;;; sicp-autoloads.el ends here
> --8<---------------cut here---------------end--------------->8---
> 
> and this does not break anything when installing packages.
> 
> > And I would explain in the comment the real-life situations where this
> > is needed, and why, rather than just explaining in English what the
> > code does.
> 
> You are right.  How does this patch look like:

LGTM, thanks.  Is Robert's use case also taken care of?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Mon, 08 May 2023 13:16:02 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: contovob <at> tcd.ie, 63260 <at> debbugs.gnu.org,
 Philip Kaludercic <philipk <at> posteo.net>
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Mon, 08 May 2023 15:15:32 +0200
>>>>> On Mon, 08 May 2023 14:16:49 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
    >> You are right.  How does this patch look like:

    Eli> LGTM, thanks.  Is Robert's use case also taken care of?

I wasnʼt aware I had one, Basil reported the bug.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Mon, 08 May 2023 13:19:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: contovob <at> tcd.ie, 63260 <at> debbugs.gnu.org, philipk <at> posteo.net
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Mon, 08 May 2023 16:18:47 +0300
> From: Robert Pluim <rpluim <at> gmail.com>
> Cc: Philip Kaludercic <philipk <at> posteo.net>,  contovob <at> tcd.ie,
>   63260 <at> debbugs.gnu.org
> Date: Mon, 08 May 2023 15:15:32 +0200
> 
> >>>>> On Mon, 08 May 2023 14:16:49 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
>     >> You are right.  How does this patch look like:
> 
>     Eli> LGTM, thanks.  Is Robert's use case also taken care of?
> 
> I wasnʼt aware I had one, Basil reported the bug.

Sorry, I thought you two reported 2 separate issues.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Mon, 08 May 2023 13:25:02 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: contovob <at> tcd.ie, 63260 <at> debbugs.gnu.org, philipk <at> posteo.net
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Mon, 08 May 2023 15:23:55 +0200
>>>>> On Mon, 08 May 2023 16:18:47 +0300, Eli Zaretskii <eliz <at> gnu.org> said:

    >> From: Robert Pluim <rpluim <at> gmail.com>
    >> Cc: Philip Kaludercic <philipk <at> posteo.net>,  contovob <at> tcd.ie,
    >> 63260 <at> debbugs.gnu.org
    >> Date: Mon, 08 May 2023 15:15:32 +0200
    >> 
    >> >>>>> On Mon, 08 May 2023 14:16:49 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
    >> >> You are right.  How does this patch look like:
    >> 
    Eli> LGTM, thanks.  Is Robert's use case also taken care of?
    >> 
    >> I wasnʼt aware I had one, Basil reported the bug.

    Eli> Sorry, I thought you two reported 2 separate issues.

There were two separate reports for this issue, plus I reported
Bug#63236, but that oneʼs fixed.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Wed, 10 May 2023 13:13:01 GMT) Full text and rfc822 format available.

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

From: Basil Contovounesios <contovob <at> tcd.ie>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63260 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>,
 rpluim <at> gmail.com
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Wed, 10 May 2023 14:12:44 +0100
Eli Zaretskii [2023-05-08 07:15 -0400] wrote:

>> From: Philip Kaludercic <philipk <at> posteo.net>
>> Cc: contovob <at> tcd.ie,  63260 <at> debbugs.gnu.org,  rpluim <at> gmail.com
>> Date: Sun, 07 May 2023 19:37:26 +0000
>> 
>> You are right.  How does this patch look like:
>
> LGTM, thanks.  Is Robert's use case also taken care of?

Both the package-install and package-quickstart-refresh issues I listed
are fixed by the patch.  I also checked that loaddefs-generate continues
to work in an external package, AFAICT:

https://github.com/kyleam/bog/blob/8fc7ff7d926ddb7291df9706b92e09cc8addcfad/Makefile#L20-L28

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63260; Package emacs. (Wed, 10 May 2023 14:22:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Basil Contovounesios <contovob <at> tcd.ie>
Cc: 63260 <at> debbugs.gnu.org, philipk <at> posteo.net, rpluim <at> gmail.com
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Wed, 10 May 2023 17:22:52 +0300
> From: Basil Contovounesios <contovob <at> tcd.ie>
> Cc: Philip Kaludercic <philipk <at> posteo.net>,  63260 <at> debbugs.gnu.org,
>   rpluim <at> gmail.com
> Date: Wed, 10 May 2023 14:12:44 +0100
> 
> Eli Zaretskii [2023-05-08 07:15 -0400] wrote:
> 
> >> From: Philip Kaludercic <philipk <at> posteo.net>
> >> Cc: contovob <at> tcd.ie,  63260 <at> debbugs.gnu.org,  rpluim <at> gmail.com
> >> Date: Sun, 07 May 2023 19:37:26 +0000
> >> 
> >> You are right.  How does this patch look like:
> >
> > LGTM, thanks.  Is Robert's use case also taken care of?
> 
> Both the package-install and package-quickstart-refresh issues I listed
> are fixed by the patch.  I also checked that loaddefs-generate continues
> to work in an external package, AFAICT:
> 
> https://github.com/kyleam/bog/blob/8fc7ff7d926ddb7291df9706b92e09cc8addcfad/Makefile#L20-L28

Thanks.




Reply sent to Philip Kaludercic <philipk <at> posteo.net>:
You have taken responsibility. (Fri, 12 May 2023 07:44:01 GMT) Full text and rfc822 format available.

Notification sent to Basil Contovounesios <contovob <at> tcd.ie>:
bug acknowledged by developer. (Fri, 12 May 2023 07:44:01 GMT) Full text and rfc822 format available.

Message #81 received at 63260-done <at> debbugs.gnu.org (full text, mbox):

From: Philip Kaludercic <philipk <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Basil Contovounesios <contovob <at> tcd.ie>, 63260-done <at> debbugs.gnu.org,
 rpluim <at> gmail.com
Subject: Re: bug#63260: 29.0.90; Regression installing/activating packages
 without autoloads
Date: Fri, 12 May 2023 07:43:08 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Basil Contovounesios <contovob <at> tcd.ie>
>> Cc: Philip Kaludercic <philipk <at> posteo.net>,  63260 <at> debbugs.gnu.org,
>>   rpluim <at> gmail.com
>> Date: Wed, 10 May 2023 14:12:44 +0100
>> 
>> Eli Zaretskii [2023-05-08 07:15 -0400] wrote:
>> 
>> >> From: Philip Kaludercic <philipk <at> posteo.net>
>> >> Cc: contovob <at> tcd.ie,  63260 <at> debbugs.gnu.org,  rpluim <at> gmail.com
>> >> Date: Sun, 07 May 2023 19:37:26 +0000
>> >> 
>> >> You are right.  How does this patch look like:
>> >
>> > LGTM, thanks.  Is Robert's use case also taken care of?
>> 
>> Both the package-install and package-quickstart-refresh issues I listed
>> are fixed by the patch.  I also checked that loaddefs-generate continues
>> to work in an external package, AFAICT:
>> 
>> https://github.com/kyleam/bog/blob/8fc7ff7d926ddb7291df9706b92e09cc8addcfad/Makefile#L20-L28
>
> Thanks.

I've pushed the changes.




Reply sent to Philip Kaludercic <philipk <at> posteo.net>:
You have taken responsibility. (Fri, 12 May 2023 07:44:02 GMT) Full text and rfc822 format available.

Notification sent to Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>:
bug acknowledged by developer. (Fri, 12 May 2023 07:44:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 09 Jun 2023 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 314 days ago.

Previous Next


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