unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Xiyue Deng <manphiz@gmail.com>
Cc: 73926@debbugs.gnu.org
Subject: bug#73926: 29.4; *-autoloads.el generation not reproducible
Date: Mon, 21 Oct 2024 12:26:20 +0300	[thread overview]
Message-ID: <86r089hkn7.fsf@gnu.org> (raw)
In-Reply-To: <87sespvqb5.fsf@debian-hx90.lan> (message from Xiyue Deng on Mon,  21 Oct 2024 01:00:14 -0700)

> From: Xiyue Deng <manphiz@gmail.com>
> Date: Mon, 21 Oct 2024 01:00:14 -0700
> 
> I was trying to debug a reproducibility test failure on muse-el in
> Debian Salsa CI reprotest[1].  It looks like that the contents of the
> generated autoload file depends on the input sequence of files and
> directories, and it looks like the `loaddefs-generate' doesn't enforce
> such a sequence to be consistent.
> 
> I have provided a patch (attached) to sort the input directories and
> files in an attempt to fix this reproducibility issue.

Did you time the modified code wrt the original one, especially when
generating loaddefs for the entire Emacs tree?  If the performance hit
is significant, we'd probably want to make this behavior optional,
like the other measures in Emacs that are meant to produce more
reproducible builds.

Also, AFAIK on MS-Windows directory-files produces a sorted list by
default (just in the reverse order), so in that case calling 'sort' is
not needed in the first place.

I also wonder whether this will produce the same order on different
operating systems, what with the file-encoding being a factor.

> --- a/lisp/emacs-lisp/loaddefs-gen.el
> +++ b/lisp/emacs-lisp/loaddefs-gen.el
> @@ -596,9 +596,13 @@ instead of just updating them with the new/changed autoloads."
>                       (concat "\\`[^=.].*" (regexp-opt tmp t) "\\'")))
>  	 (files (apply #'nconc
>  		       (mapcar (lambda (d)
> -				 (directory-files (expand-file-name d)
> -                                                  t files-re))
> -			       (if (consp dir) dir (list dir)))))
> +				 (sort
> +				  (directory-files (expand-file-name d)
> +						   t files-re)
> +				  'string<))

Isn't string< the default when 'sort' is called to sort strings?

Thanks.





      reply	other threads:[~2024-10-21  9:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  8:00 bug#73926: 29.4; *-autoloads.el generation not reproducible Xiyue Deng
2024-10-21  9:26 ` Eli Zaretskii [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=86r089hkn7.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73926@debbugs.gnu.org \
    --cc=manphiz@gmail.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 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).