automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[automake-commit] branch master updated: automake: sort keys for reprodu


From: Karl Berry
Subject: [automake-commit] branch master updated: automake: sort keys for reproducibility.
Date: Sat, 15 Jun 2024 21:18:47 -0400

This is an automated email from the git hooks/post-receive script.

karl pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=f37526175a8efec93c53bf2cd1979e1887cb5c3f

The following commit(s) were added to refs/heads/master by this push:
     new f37526175 automake: sort keys for reproducibility.
f37526175 is described below

commit f37526175a8efec93c53bf2cd1979e1887cb5c3f
Author: Yves Orton <demerphq@gmail.com>
AuthorDate: Sat Jun 15 18:18:35 2024 -0700

    automake: sort keys for reproducibility.
    
    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                           |  9 ++++++---
 THANKS                         |  1 +
 bin/aclocal.in                 |  6 +++---
 bin/automake.in                |  6 +++---
 contrib/tap-driver.pl          |  4 ++--
 lib/Automake/Channels.pm       | 10 +++++-----
 lib/Automake/Condition.pm      |  6 +++---
 lib/Automake/DisjConditions.pm |  2 +-
 lib/Automake/Getopt.pm         |  2 +-
 lib/Automake/Rule.pm           |  6 +++---
 10 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/NEWS b/NEWS
index fa6b8f842..37a66df03 100644
--- 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 c48cb0ea0..804b76727 100644
--- 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
diff --git a/bin/aclocal.in b/bin/aclocal.in
index 785263fdc..814862af2 100644
--- a/bin/aclocal.in
+++ b/bin/aclocal.in
@@ -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;
diff --git a/bin/automake.in b/bin/automake.in
index addfa8441..a17f45236 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -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/)
            {
diff --git a/contrib/tap-driver.pl b/contrib/tap-driver.pl
index 787741e38..6a57bb080 100755
--- a/contrib/tap-driver.pl
+++ b/contrib/tap-driver.pl
@@ -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 ()
diff --git a/lib/Automake/Channels.pm b/lib/Automake/Channels.pm
index adb6b2224..8fa92b83b 100644
--- a/lib/Automake/Channels.pm
+++ b/lib/Automake/Channels.pm
@@ -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'};
diff --git a/lib/Automake/Condition.pm b/lib/Automake/Condition.pm
index 03460b427..eaa925f7e 100644
--- a/lib/Automake/Condition.pm
+++ b/lib/Automake/Condition.pm
@@ -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>
diff --git a/lib/Automake/DisjConditions.pm b/lib/Automake/DisjConditions.pm
index f255d2824..1eb144c95 100644
--- a/lib/Automake/DisjConditions.pm
+++ b/lib/Automake/DisjConditions.pm
@@ -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>
diff --git a/lib/Automake/Getopt.pm b/lib/Automake/Getopt.pm
index a20059940..358ee914f 100644
--- a/lib/Automake/Getopt.pm
+++ b/lib/Automake/Getopt.pm
@@ -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$/)
            {
diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm
index da23bd803..5a61205b4 100644
--- a/lib/Automake/Rule.pm
+++ b/lib/Automake/Rule.pm
@@ -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})
        {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]