GNU bug report logs - #17908
non-deterministic behaviour of Automake

Previous Next

Package: automake;

Reported by: Peter Breitenlohner <peb <at> mppmu.mpg.de>

Date: Thu, 3 Jul 2014 12:31:02 UTC

Severity: normal

Tags: patch

Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17908 in the body.
You can then email your comments to 17908 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-automake <at> gnu.org:
bug#17908; Package automake. (Thu, 03 Jul 2014 12:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Breitenlohner <peb <at> mppmu.mpg.de>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Thu, 03 Jul 2014 12:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Peter Breitenlohner <peb <at> mppmu.mpg.de>
To: bug-automake <at> gnu.org
Cc: Karl Berry <karl <at> freefriends.org>
Subject: non-deterministic behaviour of Automake
Date: Thu, 3 Jul 2014 14:30:17 +0200 (CEST)
Hi,

in a configure.ac we use
  AC_REPLACE_FUNCS([putenv strcasecmp strtol strstr])
and consequently the make variable DIST_COMMON contains:
  putenv.c strtol.c strcasecmp.c strstr.c
but these four files are not always in the same order.

Could this be due to the "non-deterministic order of enumerating hash keys
in perl" observed in a different software project?

Regards
Peter Breitenlohner <peb <at> mppmu.mpg.de>




Information forwarded to bug-automake <at> gnu.org:
bug#17908; Package automake. (Mon, 22 Dec 2014 11:33:02 GMT) Full text and rfc822 format available.

Message #8 received at 17908 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: automake-patches <at> gnu.org
Cc: peb <at> mppmu.mpg.de, 17908 <at> debbugs.gnu.org, karl <at> freefriends.org
Subject: [PATCH] dist: ordering of files in DIST_COMMON is deterministic now
Date: Mon, 22 Dec 2014 12:32:06 +0100
It had likely stopped being deterministic due to the new perl behavior
of having non-deterministic order of numerating hash keys:
<http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Hash_randomization>
<http://onionstand.blogspot.ie/2012/12/are-you-relying-on-hash-keys-being.html>

See also similar commit v1.14-19-g52e6404.

Fixes automake bug http://debbugs.gnu.org/17908

* bin/automake.in (handle_dist): Sort @dist_common.
(print_autodist_files): Swap invocations of 'sort' and 'uniq', for
consistency with the new code in 'handle_dist' and to get rid of a
minor hack.
* NEWS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattarini <at> gmail.com>
---
 NEWS            |  6 +++++-
 bin/automake.in | 14 +++++++-------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index bdc9bb9..5d14c5e 100644
--- a/NEWS
+++ b/NEWS
@@ -116,6 +116,10 @@ New in 1.14.2:
     risks causing "Arg list too long" for projects using automatic
     dependency tracking and having a ton of source files (bug#18744).
 
+  - Automake tries to offer a more deterministic for generated Makefiles,
+    in the face of the newly-introduced randomization for hash keys order
+    in Perl 5.18.
+
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 New in 1.14.1:
@@ -131,7 +135,7 @@ New in 1.14.1:
     was only relevant when the number of python files was high (which is
     unusual in practice).
 
-  - Automake try to offer a more reproducible output for warning messages,
+  - Automake try to offer a more deterministic output for warning messages,
     in the face of the newly-introduced randomization for hash keys order
     in Perl 5.18.
 
diff --git a/bin/automake.in b/bin/automake.in
index 283d1bb..7851454 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -3714,10 +3714,13 @@ sub handle_dist ()
 	}
     }
 
-  # Files to distributed.  Don't use ->value_as_list_recursive
-  # as it recursively expands '$(dist_pkgdata_DATA)' etc.
+  # Files to distributed.  Don't use ->value_as_list_recursive as it
+  # recursively expands '$(dist_pkgdata_DATA)' etc.
+  # Use 'sort' so that the expansion of $(DIST_COMMON) in the generated
+  # Makefile is deterministic, in face of m4 and/or perl randomizations
+  # (see automake bug#17908).
   my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
-  @dist_common = uniq (@dist_common);
+  @dist_common = uniq (sort @dist_common);
   variable_delete 'DIST_COMMON';
   define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
 
@@ -7883,10 +7886,7 @@ sub generate_makefile
 # Helper function for usage().
 sub print_autodist_files
 {
-  # NOTE: we need to call our 'uniq' function with the leading '&'
-  # here, because otherwise perl complains that "Unquoted string
-  # 'uniq' may clash with future reserved word".
-  my @lcomm = sort (&uniq (@_));
+  my @lcomm = uniq (sort @_);
 
   my @four;
   format USAGE_FORMAT =
-- 
2.1.3





Information forwarded to bug-automake <at> gnu.org:
bug#17908; Package automake. (Mon, 22 Dec 2014 12:31:01 GMT) Full text and rfc822 format available.

Message #11 received at 17908 <at> debbugs.gnu.org (full text, mbox):

From: Peter Rosin <peda <at> lysator.liu.se>
To: Stefano Lattarini <stefano.lattarini <at> gmail.com>, automake-patches <at> gnu.org
Cc: peb <at> mppmu.mpg.de, 17908 <at> debbugs.gnu.org, karl <at> freefriends.org
Subject: Re: [PATCH] dist: ordering of files in DIST_COMMON is deterministic
 now
Date: Mon, 22 Dec 2014 13:30:27 +0100
> diff --git a/NEWS b/NEWS
> index bdc9bb9..5d14c5e 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -116,6 +116,10 @@ New in 1.14.2:
>      risks causing "Arg list too long" for projects using automatic
>      dependency tracking and having a ton of source files (bug#18744).
>  
> +  - Automake tries to offer a more deterministic for generated Makefiles,

Is "output" missing?

> +    in the face of the newly-introduced randomization for hash keys order
> +    in Perl 5.18.

Cheers,
Peter





Information forwarded to bug-automake <at> gnu.org:
bug#17908; Package automake. (Mon, 22 Dec 2014 12:40:01 GMT) Full text and rfc822 format available.

Message #14 received at 17908 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: Peter Rosin <peda <at> lysator.liu.se>, automake-patches <at> gnu.org
Cc: peb <at> mppmu.mpg.de, 17908 <at> debbugs.gnu.org, karl <at> freefriends.org
Subject: Re: [PATCH] dist: ordering of files in DIST_COMMON is deterministic
 now
Date: Mon, 22 Dec 2014 13:39:08 +0100
Hi Peter.

On 12/22/2014 01:30 PM, Peter Rosin wrote:
>> diff --git a/NEWS b/NEWS
>> index bdc9bb9..5d14c5e 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -116,6 +116,10 @@ New in 1.14.2:
>>       risks causing "Arg list too long" for projects using automatic
>>       dependency tracking and having a ton of source files (bug#18744).
>>
>> +  - Automake tries to offer a more deterministic for generated Makefiles,
>
> Is "output" missing?
>
Yes it is! Thanks for spotting; will fix before pushing.

Cheers,
  Stefano




Added tag(s) patch. Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 22 Dec 2014 18:54:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 17908 <at> debbugs.gnu.org and Peter Breitenlohner <peb <at> mppmu.mpg.de> Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 22 Dec 2014 18:54:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 20 Jan 2015 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 70 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.