]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
automake: sort keys for reproducibility.
authorYves Orton <demerphq@gmail.com>
Sun, 16 Jun 2024 01:18:35 +0000 (18:18 -0700)
committerKarl Berry <karl@freefriends.org>
Sun, 16 Jun 2024 01:18:35 +0000 (18:18 -0700)
Fixes https://bugs.gnu.org/25629.

* bin/aclocal.in: sort keys for reproducibility.
* bin/automake.in: likewise.
* contrib/tap-driver.pl: likewise.
* lib/Automake/Channels.pm: likewise.
* lib/Automake/Condition.pm: likewise.
* lib/Automake/DisjConditions.pm: likewise.
* lib/Automake/Getopt.pm: likewise.
* lib/Automake/Rule.pm: likewise.
* THANKS: Add Yves.
* NEWS: mention this.

NEWS
THANKS
bin/aclocal.in
bin/automake.in
contrib/tap-driver.pl
lib/Automake/Channels.pm
lib/Automake/Condition.pm
lib/Automake/DisjConditions.pm
lib/Automake/Getopt.pm
lib/Automake/Rule.pm

diff --git a/NEWS b/NEWS
index fa6b8f842dae6d9e548c751a84425db95de9cb5f..37a66df032d75b8d80b44f76c5048c6b97e6b00b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -103,12 +103,15 @@ New in 1.17:
     that can show up on network file systems.
     (https://lists.gnu.org/archive/html/automake/2022-09/msg00002.html)
 
-  - tests: avoid some declaration conflicts for lex et al. on SunOS.
-    (bug#34151 and others)
-
   - Pass any options given to AM_PROG_LEX on to AC_PROG_LEX.
     (bug#65600, bug#65730)
 
+  - Hash iterations with external effects now consistently sort keys.
+    (bug#25629)
+
+  - tests: avoid some declaration conflicts for lex et al. on SunOS.
+    (bug#34151 and others)
+
   - Typos in code and other doc fixes. (bug#68003, bug#68004, et al.)
 
 * Obsolescence:
diff --git a/THANKS b/THANKS
index c48cb0ea04b5a89bc6df4b2ed9782a7426113c97..804b76727f4852cf75cd64aa4cdea92c259e76a1 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -461,6 +461,7 @@ William Pursell                 bill.pursell@gmail.com
 William S Fulton                wsf@fultondesigns.co.uk
 Yann Droneaud                   ydroneaud@meuh.eu.org
 Younes Younes                   younes@cs.tu-berlin.de
+Yves Orton                      demerphq@gmail.com
 Zack Weinberg                   zack@owlfolio.org
 Zbigniew JÄ™drzejewski-Szmek     zbyszek@in.waw.pl
 Zoltan Rado                     z.rado@chello.hu
index 785263fdcaf66441aa8c84c5fdc945ba4497ef1b..814862af2d7602db8a442df6c9bcec302683a915 100644 (file)
@@ -233,7 +233,7 @@ sub xmkdir_p ($)
 # Check macros in acinclude.m4.  If one is not used, warn.
 sub check_acinclude ()
 {
-  foreach my $key (keys %map)
+  foreach my $key (sort keys %map)
     {
       # FIXME: should print line number of acinclude.m4.
       msg ('syntax', "macro '$key' defined in acinclude.m4 but never used")
@@ -802,7 +802,7 @@ sub trace_used_macros ()
                   # Do not trace $1 for all other macros as we do
                   # not need it and it might contains harmful
                   # characters (like newlines).
-                  (map { "--trace='$_:\$f::\$n'" } (keys %macro_seen)));
+                  (map { "--trace='$_:\$f::\$n'" } (sort keys %macro_seen)));
 
   verb "running WARNINGS=$ENV{WARNINGS} $traces $configure_ac";
 
@@ -1229,7 +1229,7 @@ while (1)
               "-I options nor AC_CONFIG_MACRO_DIR{,S} m4 macro(s)";
       }
 
-    last if write_aclocal ($output_file, keys %macro_traced);
+    last if write_aclocal ($output_file, sort keys %macro_traced);
     last if $dry_run;
   }
 check_acinclude;
index addfa84410636b7dbd1e1b66d304546676dc453b..a17f45236ded7e087a60f5ac51fe54506fe8abdd 100644 (file)
@@ -1558,7 +1558,7 @@ sub handle_languages ()
     # suffix rule was learned), don't bother with the C stuff.  But if
     # anything else creeps in, then use it.
     my @languages_seen = map { $languages{$extension_map{$_}}->name }
-                             (keys %extension_seen);
+                             (sort keys %extension_seen);
     @languages_seen = uniq (@languages_seen);
     $needs_c = 1 if @languages_seen > 1;
     if ($need_link || $needs_c)
@@ -3687,14 +3687,14 @@ sub handle_man_pages ()
       my $trans_mans = $have_trans || exists $trans_sections{$section};
       my (%notrans_this_sect, %trans_this_sect);
       my $expr = 'man' . $section . '_MANS';
-      foreach my $varname (keys %notrans_sect_vars)
+      foreach my $varname (keys %notrans_sect_vars) # sort keys not needed
        {
          if ($varname =~ /$expr/)
            {
              $notrans_this_sect{$varname} = 1;
            }
        }
-      foreach my $varname (keys %trans_sect_vars)
+      foreach my $varname (keys %trans_sect_vars) # sort keys not needed
        {
          if ($varname =~ /$expr/)
            {
index 787741e3878331b1554888e1ff8e40d22aae7246..6a57bb0800fbd51a39b50857d639b083a36f7665 100755 (executable)
@@ -198,14 +198,14 @@ TEST_RESULTS :
   # Whether the test script should be re-run by "make recheck".
   sub must_recheck ()
   {
-    return grep { !/^(?:XFAIL|PASS|SKIP)$/ } (keys %test_results_seen);
+    return grep { !/^(?:XFAIL|PASS|SKIP)$/ } (sort keys %test_results_seen);
   }
 
   # Whether the content of the log file associated to this test should
   # be copied into the "global" test-suite.log.
   sub copy_in_global_log ()
   {
-    return grep { not $_ eq "PASS" } (keys %test_results_seen);
+    return grep { not $_ eq "PASS" } (sort keys %test_results_seen);
   }
 
   sub get_global_test_result ()
index adb6b2224b2f4fcf5e4cbc08104bd875bdfa9de4..8fa92b83bbbcb5c9827f7fb8432fc71fd0413061 100644 (file)
@@ -286,7 +286,7 @@ sub _reset_duplicates (\%)
 {
   my ($ref) = @_;
   my $dup = 0;
-  foreach my $k (keys %$ref)
+  foreach my $k (keys %$ref) # sort keys not needed
     {
       $dup += $ref->{$k};
     }
@@ -328,7 +328,7 @@ sub _merge_options (\%%)
   my ($hash, %options) = @_;
   local $_;
 
-  foreach (keys %options)
+  foreach (sort keys %options)
     {
       if (exists $hash->{$_})
        {
@@ -731,7 +731,7 @@ with those specified by C<%options>.
 sub setup_channel_type ($%)
 {
   my ($type, %opts) = @_;
-  foreach my $channel (keys %channels)
+  foreach my $channel (sort keys %channels)
     {
       setup_channel $channel, %opts
        if $channels{$channel}{'type'} eq $type;
@@ -759,7 +759,7 @@ our @_saved_werrors = ();
 sub dup_channel_setup ()
 {
   my %channels_copy;
-  foreach my $k1 (keys %channels)
+  foreach my $k1 (keys %channels) # sort keys not needed
     {
       $channels_copy{$k1} = {%{$channels{$k1}}};
     }
@@ -823,7 +823,7 @@ and the key to use for serialization.
 sub setup_channel_queue ($$)
 {
   my ($queue, $key) = @_;
-  foreach my $channel (keys %channels)
+  foreach my $channel (sort keys %channels)
     {
       setup_channel $channel, queue => $queue, queue_key => $key
         if $channels{$channel}{'ordered'};
index 03460b42773b9624f0df8bb5d4b5a2d4b2f4d394..eaa925f7eaf99db31b7b8c93ffc207dc7560b37d 100644 (file)
@@ -273,9 +273,9 @@ For instance C<$c3-E<gt>conds> will simply return C<("FALSE")>.
 sub conds ($ )
 {
   my ($self) = @_;
-  my @conds = keys %{$self->{'hash'}};
+  my @conds = sort keys %{$self->{'hash'}};
   return ("TRUE") unless @conds;
-  return sort @conds;
+  return @conds;
 }
 
 # Undocumented, shouldn't be needed outside of this class.
@@ -306,7 +306,7 @@ Return 1 iff this condition is always true.
 sub true ($ )
 {
   my ($self) = @_;
-  return 0 == keys %{$self->{'hash'}};
+  return 0 == keys %{$self->{'hash'}}; # sort not needed
 }
 
 =item C<$cond-E<gt>string>
index f255d28242212fac2220745f40264685b15d8020..1eb144c952fd0b2b8cd5c16789df0adf9a5f59ad 100644 (file)
@@ -250,7 +250,7 @@ otherwise.
 sub false ($ )
 {
   my ($self) = @_;
-  return 0 == keys %{$self->{'hash'}};
+  return 0 == keys %{$self->{'hash'}}; # sort keys not needed
 }
 
 =item C<$et = $set-E<gt>true>
index a200599401830f1e912e5871618760992b3062ff..358ee914f73eae3105a222e8f43d7ef2d1449670 100644 (file)
@@ -68,7 +68,7 @@ sub parse_options (%)
   if (@ARGV && $ARGV[0] =~ /^-./)
     {
       my %argopts;
-      for my $k (keys %option)
+      for my $k (keys %option) # sort keys not needed
        {
          if ($k =~ /(.*)=s$/)
            {
index da23bd8034b1ec46f256c4d0962b72c0f1c3c517..5a61205b444c9d999d9bf6292050312703f145cb 100644 (file)
@@ -430,7 +430,7 @@ sub register_suffix_rule ($$$)
   # we know how to transform $src in that "something else".
   if (exists $suffix_rules->{$dest})
     {
-      for my $dest2 (keys %{$suffix_rules->{$dest}})
+      for my $dest2 (sort keys %{$suffix_rules->{$dest}})
        {
          my $dist = $suffix_rules->{$dest}{$dest2}[1] + 1;
          # Overwrite an existing $src->$dest2 path only if
@@ -445,8 +445,8 @@ sub register_suffix_rule ($$$)
 
   # Similarly, any extension that can be derived into $src
   # can be derived into the same extensions as $src can.
-  my @dest2 = keys %{$suffix_rules->{$src}};
-  for my $src2 (keys %$suffix_rules)
+  my @dest2 = sort keys %{$suffix_rules->{$src}};
+  for my $src2 (sort keys %$suffix_rules)
     {
       if (exists $suffix_rules->{$src2}{$src})
        {