unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48181: incremental autoloads update can put output in wrong file
@ 2021-05-03  1:08 Glenn Morris
  2021-05-03 11:37 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Glenn Morris @ 2021-05-03  1:08 UTC (permalink / raw)
  To: 48181; +Cc: Stefan Monnier

Package: emacs
Version: 28.0.50

I tried to figure out exactly why 68bf917896 caused non-bootstrap builds
to fail, because IIUC in theory it shouldn't have. I think this is why:

1) before 68bf917896, lisp/loaddefs.el contains sections like this:

  ;;;### (autoloads nil "texnfo-upd" "textmodes/texnfo-upd.el" (0 0
  ;;;;;;  0 0))
  ;;; Generated autoloads from textmodes/texnfo-upd.el

  (register-definition-prefixes "texnfo-upd" '("texinfo-"))

So even though there aren't any real autoloads in texnfo-upd.el, it's
not in the "no autoloads" section.

2) 68bf917896 added real autoload cookies to texnfo-upd.el, and set
generated-autoload-file to texinfo-loaddefs.el.

3) make-directory-autoloads correctly finds that texnfo-upd.el is newer
than loaddefs.el, so we execute this branch:
  
  (t
   (setq changed t)
   (autoload-remove-section (match-beginning 0))
   (if (autoload-generate-file-autoloads
         ;; Passing `current-buffer' makes it insert at point.   
         file (current-buffer) buffer-file-name)
        (push file no-autoloads)))

Because a non-nil OUTBUF is passed to autoload-generate-file-autoloads,
it ignores the buffer-local setting for generated-autoload-file,
and so puts the autoloads in the main loaddefs.el file, which is wrong.


In contrast, if the input loaddefs.el file in step 1 had texnfo-upd.el
in the "no loaddefs" section, then we would execute this branch:

  ;; Passing nil as second argument forces                             
  ;; autoload-generate-file-autoloads to look for the right            
  ;; spot where to insert each autoloads section.                      
  ((setq file-time
         (autoload-generate-file-autoloads file nil buffer-file-name))
 
As the comment says, this version has OUTBUF nil, so the loaddefs end up
the right file.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#48181: incremental autoloads update can put output in wrong file
  2021-05-03  1:08 bug#48181: incremental autoloads update can put output in wrong file Glenn Morris
@ 2021-05-03 11:37 ` Eli Zaretskii
  2021-05-03 12:49 ` Stefan Monnier
  2022-06-05 16:31 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2021-05-03 11:37 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 48181, monnier

> From: Glenn Morris <rgm@gnu.org>
> Date: Sun, 02 May 2021 21:08:57 -0400
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>
> 
> 1) before 68bf917896, lisp/loaddefs.el contains sections like this:
> 
>   ;;;### (autoloads nil "texnfo-upd" "textmodes/texnfo-upd.el" (0 0
>   ;;;;;;  0 0))
>   ;;; Generated autoloads from textmodes/texnfo-upd.el
> 
>   (register-definition-prefixes "texnfo-upd" '("texinfo-"))

(The other 2 files, makeinfo.el and texinfo.el, are also related,
right?)

> So even though there aren't any real autoloads in texnfo-upd.el, it's
> not in the "no autoloads" section.
> 
> 2) 68bf917896 added real autoload cookies to texnfo-upd.el, and set
> generated-autoload-file to texinfo-loaddefs.el.
> 
> 3) make-directory-autoloads correctly finds that texnfo-upd.el is newer
> than loaddefs.el, so we execute this branch:
>   
>   (t
>    (setq changed t)
>    (autoload-remove-section (match-beginning 0))
>    (if (autoload-generate-file-autoloads
>          ;; Passing `current-buffer' makes it insert at point.   
>          file (current-buffer) buffer-file-name)
>         (push file no-autoloads)))
> 
> Because a non-nil OUTBUF is passed to autoload-generate-file-autoloads,
> it ignores the buffer-local setting for generated-autoload-file,
> and so puts the autoloads in the main loaddefs.el file, which is wrong.
> 
> 
> In contrast, if the input loaddefs.el file in step 1 had texnfo-upd.el
> in the "no loaddefs" section, then we would execute this branch:
> 
>   ;; Passing nil as second argument forces                             
>   ;; autoload-generate-file-autoloads to look for the right            
>   ;; spot where to insert each autoloads section.                      
>   ((setq file-time
>          (autoload-generate-file-autoloads file nil buffer-file-name))
>  
> As the comment says, this version has OUTBUF nil, so the loaddefs end up
> the right file.

Yes, I've also figured out that by suitable editing of the nascent
loaddefs.el I could fix the original problem.  But such manual editing
sounded gross to me.

Or are you saying something else?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#48181: incremental autoloads update can put output in wrong file
  2021-05-03  1:08 bug#48181: incremental autoloads update can put output in wrong file Glenn Morris
  2021-05-03 11:37 ` Eli Zaretskii
@ 2021-05-03 12:49 ` Stefan Monnier
  2022-06-05 16:31 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2021-05-03 12:49 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 48181

> 3) make-directory-autoloads correctly finds that texnfo-upd.el is newer
> than loaddefs.el, so we execute this branch:
>   
>   (t
>    (setq changed t)
>    (autoload-remove-section (match-beginning 0))
>    (if (autoload-generate-file-autoloads
>          ;; Passing `current-buffer' makes it insert at point.   
>          file (current-buffer) buffer-file-name)
>         (push file no-autoloads)))
>
> Because a non-nil OUTBUF is passed to autoload-generate-file-autoloads,
> it ignores the buffer-local setting for generated-autoload-file,
> and so puts the autoloads in the main loaddefs.el file, which is wrong.

Yep, sounds like you found of the bug.


        Stefan






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#48181: incremental autoloads update can put output in wrong file
  2021-05-03  1:08 bug#48181: incremental autoloads update can put output in wrong file Glenn Morris
  2021-05-03 11:37 ` Eli Zaretskii
  2021-05-03 12:49 ` Stefan Monnier
@ 2022-06-05 16:31 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-05 16:31 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 48181, Stefan Monnier

Glenn Morris <rgm@gnu.org> writes:

> I tried to figure out exactly why 68bf917896 caused non-bootstrap builds
> to fail, because IIUC in theory it shouldn't have. I think this is why:

This should be fixed in Emacs 29 now with the complete rewrite in how
these files are updated, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-05 16:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03  1:08 bug#48181: incremental autoloads update can put output in wrong file Glenn Morris
2021-05-03 11:37 ` Eli Zaretskii
2021-05-03 12:49 ` Stefan Monnier
2022-06-05 16:31 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).