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
  2021-05-03 12:49 ` Stefan Monnier
  0 siblings, 2 replies; 3+ 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] 3+ 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
  1 sibling, 0 replies; 3+ 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] 3+ 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
  1 sibling, 0 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2021-05-03 12:49 UTC | newest]

Thread overview: 3+ 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

unofficial mirror of bug-gnu-emacs@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/emacs-bugs/0 emacs-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 emacs-bugs emacs-bugs/ https://yhetil.org/emacs-bugs \
		bug-gnu-emacs@gnu.org
	public-inbox-index emacs-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.bugs
	nntp://news.gmane.io/gmane.emacs.bugs


code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git