Bugzilla – Bug 1182604
automake creates non-deterministic output
Last modified: 2023-04-06 15:59:27 UTC
While working on reproducible builds for openSUSE, I found that when building our pcre package, it varied /usr/libexec/pcre/testsuite/Makefile created from varying Makefile.in created by automake I did with osc build + osc chroot cd ~/rpmbuild/BUILD/pcre-8.44 for i in $(seq 1 10 ) ; do automake --add-missing --copy --force-missing 2>/dev/null md5sum Makefile.in done |sort|uniq -c 4 d18dc119aa88ac245d946fa4ea74e934 Makefile.in 6 e05d9741e836163b6137d3c2cca6ac58 Makefile.in My analysis tools tell me, that the output becomes deterministic when having deterministic readdir order and disabled ASLR. e.g. in the above example, one can add setarch -R to get 10 times the same result, because the filesystem does not change during the test. We want to be able to reproduce identical output later+elsewhere.
Adding some diffs to help debugging: +++ /usr/libexec/pcre/testsuite/Makefile -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -distclean-local: clean-local: +distclean-local: +++ /home/abuild/rpmbuild/BUILD/pcre-8.44/Makefile.in @@ -3103,8 +3103,8 @@ @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -@WITH_GCOV_FALSE@distclean-local: @WITH_GCOV_FALSE@clean-local: +@WITH_GCOV_FALSE@distclean-local:
yeah, so that basically indicates missing sort's in iterating over perl hashes in bin/automake.in in many cases that I've seen, it does do a foreach on sorted keys, but maybe we're missing something here and there. IMHO this is an upsteram problem, care to report it there?
Created attachment 846418 [details] automake-reproducible.patch
This is an autogenerated message for OBS integration: This bug (1182604) was mentioned in https://build.opensuse.org/request/show/874730 Factory / automake
Thanks Dirk! I just reported this bug upstream to bug-automake@gnu.org, attaching your patch (giving due credit!). I'll close this bug now.
Thanks Dirk and Josef.
SUSE-RU-2021:2173-1: An update that has 5 recommended fixes and contains one feature can now be installed. Category: recommended (moderate) Bug References: 1040589,1047218,1182604,1185540,1186049 CVE References: JIRA References: SLE-17848 Sources used: SUSE MicroOS 5.0 (src): pcre-8.41-6.4.2 SUSE Linux Enterprise Module for Development Tools 15-SP3 (src): brp-check-suse-84.87+git20181106.224b37d-3.18.2 SUSE Linux Enterprise Module for Development Tools 15-SP2 (src): brp-check-suse-84.87+git20181106.224b37d-3.18.2 SUSE Linux Enterprise Module for Basesystem 15-SP3 (src): automake-1.15.1-4.10.2, pcre-8.41-6.4.2 SUSE Linux Enterprise Module for Basesystem 15-SP2 (src): automake-1.15.1-4.10.2, pcre-8.41-6.4.2 NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
openSUSE-RU-2021:0963-1: An update that has 5 recommended fixes and contains one feature can now be installed. Category: recommended (moderate) Bug References: 1040589,1047218,1182604,1185540,1186049 CVE References: JIRA References: SLE-17848 Sources used: openSUSE Leap 15.2 (src): automake-1.15.1-lp152.5.3.1, automake-testsuite-1.15.1-lp152.5.3.1, brp-check-suse-84.87+git20181106.224b37d-lp152.2.12.1, pcre-8.41-lp152.7.3.1
openSUSE-RU-2021:2173-1: An update that has 5 recommended fixes and contains one feature can now be installed. Category: recommended (moderate) Bug References: 1040589,1047218,1182604,1185540,1186049 CVE References: JIRA References: SLE-17848 Sources used: openSUSE Leap 15.3 (src): automake-1.15.1-4.10.2, brp-check-suse-84.87+git20181106.224b37d-3.18.2, pcre-8.41-6.4.2