diff mbox series

gotools: Workaround non-reproduceability of automake

Message ID Zh0grrP/MPu3pXbC@tucnak
State New
Headers show
Series gotools: Workaround non-reproduceability of automake | expand

Commit Message

Jakub Jelinek April 15, 2024, 12:42 p.m. UTC
Hi!

The regen bot recently flagged a difference in gotools/Makefile.in.
Trying it locally, it seems pretty random
for i in `seq 20`; do PATH=~/automake-1.15.1/bin:~/autoconf-2.69/bin:$PATH automake; echo -n `git diff Makefile.in | wc -l`" "; done; echo; for i in `seq 20`; do PATH=~/automake-1.15.1/bin:~/autoconf-2.69/bin:$PATH setarch x86_64 -R automake; echo -n `git diff Makefile.in | wc -l`" "; done; echo;
14 14 14 0 0 0 14 0 14 0 14 14 14 14 0 14 14 0 0 0 
14 0 14 0 0 14 14 14 0 14 14 0 0 14 14 14 0 0 0 14 
The 14 line git diff is

	Jakub

Comments

Ian Lance Taylor April 15, 2024, 5:38 p.m. UTC | #1
On Mon, Apr 15, 2024 at 5:42 AM Jakub Jelinek <jakub@redhat.com> wrote:
>
> 2024-04-15  Jakub Jelinek  <jakub@redhat.com>
>
>         * Makefile.am (install-exec-local, uninstall-local): Add goals
>         on the else branch of if NATIVE to ensure reproducibility.
>         * Makefile.in: Regenerate.

This is OK.  Go ahead and commit.  Thanks.

Ian
Eric Gallager April 15, 2024, 8:20 p.m. UTC | #2
On Mon, Apr 15, 2024 at 8:43 AM Jakub Jelinek <jakub@redhat.com> wrote:
>
> Hi!
>
> The regen bot recently flagged a difference in gotools/Makefile.in.
> Trying it locally, it seems pretty random
> for i in `seq 20`; do PATH=~/automake-1.15.1/bin:~/autoconf-2.69/bin:$PATH automake; echo -n `git diff Makefile.in | wc -l`" "; done; echo; for i in `seq 20`; do PATH=~/automake-1.15.1/bin:~/autoconf-2.69/bin:$PATH setarch x86_64 -R automake; echo -n `git diff Makefile.in | wc -l`" "; done; echo;
> 14 14 14 0 0 0 14 0 14 0 14 14 14 14 0 14 14 0 0 0
> 14 0 14 0 0 14 14 14 0 14 14 0 0 14 14 14 0 0 0 14
> The 14 line git diff is
> diff --git a/gotools/Makefile.in b/gotools/Makefile.in
> index 36c2ec2abd3..f40883c39be 100644
> --- a/gotools/Makefile.in
> +++ b/gotools/Makefile.in
> @@ -704,8 +704,8 @@ distclean-generic:
>  maintainer-clean-generic:
>         @echo "This command is intended for maintainers to use"
>         @echo "it deletes files that may require special tools to rebuild."
> -@NATIVE_FALSE@install-exec-local:
>  @NATIVE_FALSE@uninstall-local:
> +@NATIVE_FALSE@install-exec-local:
>  clean: clean-am
>
>  clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
> so whether it is
> @NATIVE_FALSE@install-exec-local:
> @NATIVE_FALSE@uninstall-local:
> or
> @NATIVE_FALSE@uninstall-local:
> @NATIVE_FALSE@install-exec-local:
> depends on some hash table traversal or what.
>
> I'm not familiar with automake/m4 enough to debug that, so I'm
> instead offering a workaround, with this patch the order is deterministic.

Is there a bug open with automake upstream for this?

>
> 2024-04-15  Jakub Jelinek  <jakub@redhat.com>
>
>         * Makefile.am (install-exec-local, uninstall-local): Add goals
>         on the else branch of if NATIVE to ensure reproducibility.
>         * Makefile.in: Regenerate.
>
> --- gotools/Makefile.am.jj      2023-11-04 09:02:35.802995614 +0100
> +++ gotools/Makefile.am 2024-04-15 14:30:03.647171636 +0200
> @@ -366,5 +366,7 @@ else
>  # only do this if such a compiler is available.  We also need to get
>  # the right values for GOARCH and GOOS in the default build context in
>  # the go/build package.  Figure this out later.
> +install-exec-local:
> +uninstall-local:
>
>  endif
> --- gotools/Makefile.in.jj      2023-11-03 17:08:46.000439645 +0100
> +++ gotools/Makefile.in 2024-04-15 14:31:32.270040117 +0200
> @@ -704,8 +704,6 @@ distclean-generic:
>  maintainer-clean-generic:
>         @echo "This command is intended for maintainers to use"
>         @echo "it deletes files that may require special tools to rebuild."
> -@NATIVE_FALSE@install-exec-local:
> -@NATIVE_FALSE@uninstall-local:
>  clean: clean-am
>
>  clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
> @@ -1035,6 +1033,8 @@ mostlyclean-local:
>  # only do this if such a compiler is available.  We also need to get
>  # the right values for GOARCH and GOOS in the default build context in
>  # the go/build package.  Figure this out later.
> +@NATIVE_FALSE@install-exec-local:
> +@NATIVE_FALSE@uninstall-local:
>
>  # Tell versions [3.59,3.63) of GNU make to not export all variables.
>  # Otherwise a system limit (for SysV at least) may be exceeded.
>
>         Jakub
>
Jakub Jelinek April 15, 2024, 8:30 p.m. UTC | #3
On Mon, Apr 15, 2024 at 04:20:16PM -0400, Eric Gallager wrote:
> > I'm not familiar with automake/m4 enough to debug that, so I'm
> > instead offering a workaround, with this patch the order is deterministic.
> 
> Is there a bug open with automake upstream for this?

No, feel free to file it.

	Jakub
Jakub Jelinek April 16, 2024, 9:09 a.m. UTC | #4
On Mon, Apr 15, 2024 at 10:30:15PM +0200, Jakub Jelinek wrote:
> On Mon, Apr 15, 2024 at 04:20:16PM -0400, Eric Gallager wrote:
> > > I'm not familiar with automake/m4 enough to debug that, so I'm
> > > instead offering a workaround, with this patch the order is deterministic.
> > 
> > Is there a bug open with automake upstream for this?
> 
> No, feel free to file it.

Frederic Berat said this is most likely
https://bugs.gnu.org/46744
so if/once we update to automake 1.16.5, we could remove the workaround.

	Jakub
diff mbox series

Patch

diff --git a/gotools/Makefile.in b/gotools/Makefile.in
index 36c2ec2abd3..f40883c39be 100644
--- a/gotools/Makefile.in
+++ b/gotools/Makefile.in
@@ -704,8 +704,8 @@  distclean-generic:
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
-@NATIVE_FALSE@install-exec-local:
 @NATIVE_FALSE@uninstall-local:
+@NATIVE_FALSE@install-exec-local:
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
so whether it is
@NATIVE_FALSE@install-exec-local:
@NATIVE_FALSE@uninstall-local:
or
@NATIVE_FALSE@uninstall-local:
@NATIVE_FALSE@install-exec-local:
depends on some hash table traversal or what.

I'm not familiar with automake/m4 enough to debug that, so I'm
instead offering a workaround, with this patch the order is deterministic.

2024-04-15  Jakub Jelinek  <jakub@redhat.com>

	* Makefile.am (install-exec-local, uninstall-local): Add goals
	on the else branch of if NATIVE to ensure reproducibility.
	* Makefile.in: Regenerate.

--- gotools/Makefile.am.jj	2023-11-04 09:02:35.802995614 +0100
+++ gotools/Makefile.am	2024-04-15 14:30:03.647171636 +0200
@@ -366,5 +366,7 @@  else
 # only do this if such a compiler is available.  We also need to get
 # the right values for GOARCH and GOOS in the default build context in
 # the go/build package.  Figure this out later.
+install-exec-local:
+uninstall-local:
 
 endif
--- gotools/Makefile.in.jj	2023-11-03 17:08:46.000439645 +0100
+++ gotools/Makefile.in	2024-04-15 14:31:32.270040117 +0200
@@ -704,8 +704,6 @@  distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-@NATIVE_FALSE@install-exec-local:
-@NATIVE_FALSE@uninstall-local:
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
@@ -1035,6 +1033,8 @@  mostlyclean-local:
 # only do this if such a compiler is available.  We also need to get
 # the right values for GOARCH and GOOS in the default build context in
 # the go/build package.  Figure this out later.
+@NATIVE_FALSE@install-exec-local:
+@NATIVE_FALSE@uninstall-local:
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.