LP#1527731: Force stable hash key ordering
authorMike Rylander <mrylander@gmail.com>
Wed, 23 Aug 2017 22:32:59 +0000 (18:32 -0400)
committerMike Rylander <mrylander@gmail.com>
Wed, 23 Aug 2017 22:32:59 +0000 (18:32 -0400)
Due to changes in Perl internals, some perl<->json assumptions no longer hold
as of perl 5.18.  This commit forces stable hash key generation and ordering
so that some of our uses do not suffer.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
bin/opensrf-perl.pl.in

index 40015e3..e20403d 100755 (executable)
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 # ---------------------------------------------------------------
+
+BEGIN {
+  #warn("Checking PERL_HASH_SEED...\n");
+  if (!defined($ENV{PERL_HASH_SEED}) or $ENV{PERL_HASH_SEED} !=0) {
+    my $cmd = join(' ', 'PERL_HASH_SEED=0 /usr/bin/perl', $0, @ARGV);
+    #warn("Restarting with PERL_HASH_SEED=0: $cmd \n");
+    exec($cmd) or die "Cannot exec";
+  }
+}
+
 use strict; use warnings;
 use Getopt::Long;
 use Net::Domain qw/hostfqdn/;