Subject: | Patch for 5.10 failures (closes 39759, 50300, 53833) |
The attached patch fixes the failing tests in 0.43 under 5.10.1.
The problem is that the code uses the old thread model; the attached
code checks for 5.10 or better, loads the appropriate thread modules,
and shares the variables that throw the errors.
Test suite passes.
Subject: | Net-Daemon-5.10-support.patch |
diff -ruad Net-Daemon/ChangeLog Net-Daemon-fixed/ChangeLog
--- Net-Daemon/ChangeLog 2010-03-12 14:38:33.000000000 -0800
+++ Net-Daemon-fixed/ChangeLog 2010-03-12 14:45:56.000000000 -0800
@@ -1,4 +1,7 @@
-
+2009-03-12 Joe McMahon <mcmahon@blekko.com> (0.44)
+ * Added necessary thread sharing to work with 5.10
+ threads model: regexp-threads,
+ * Bumped minimum required perl to 5.10.
2007-06-17 Malcolm Nooning <m.nooning@comcast.net> (0.43)
* lib/Net/Daemon.pm Needed to up the VERSION number
2007-06-16 Malcolm Nooning <m.nooning@comcast.net> (0.42)
diff -ruad Net-Daemon/lib/Net/Daemon.pm Net-Daemon-fixed/lib/Net/Daemon.pm
--- Net-Daemon/lib/Net/Daemon.pm 2010-03-12 14:38:33.000000000 -0800
+++ Net-Daemon-fixed/lib/Net/Daemon.pm 2010-03-12 15:13:14.000000000 -0800
@@ -20,7 +20,6 @@
#
############################################################################
-require 5.004;
use strict;
use Getopt::Long ();
@@ -30,10 +29,21 @@
use Net::Daemon::Log ();
use POSIX ();
-
package Net::Daemon;
-$Net::Daemon::VERSION = '0.43';
+# Dummy share() in case we're not 5.10. If we are, require/import of
+# threads::shared will replace it appropriately.
+my $this_is_510 = $^V ge v5.10.0;
+if ($this_is_510) {
+ no warnings 'redefine';
+ eval { require threads; };
+ eval { require threads::shared; };
+}
+else {
+ eval { require Threads; };
+}
+
+$Net::Daemon::VERSION = '0.43';
@Net::Daemon::ISA = qw(Net::Daemon::Log);
#
@@ -41,6 +51,7 @@
# regexp-threads.)
#
$Net::Daemon::RegExpLock = 1;
+threads::shared::share(\$Net::Daemon::RegExpLock) if $this_is_510;
use vars qw($exit);
diff -ruad Net-Daemon/log Net-Daemon-fixed/log
--- Net-Daemon/log 2010-03-12 14:38:33.000000000 -0800
+++ Net-Daemon-fixed/log 2010-03-12 15:13:32.000000000 -0800
@@ -1,10 +1,10 @@
-ok 3
-ok 2
ok 1
+ok 3
ok 6
-ok 4
+ok 2
ok 5
-ok 7
-ok 9
ok 10
+ok 9
+ok 4
+ok 7
ok 8
diff -ruad Net-Daemon/regexp-threads Net-Daemon-fixed/regexp-threads
--- Net-Daemon/regexp-threads 2010-03-12 14:38:33.000000000 -0800
+++ Net-Daemon-fixed/regexp-threads 2010-03-12 15:11:30.000000000 -0800
@@ -13,9 +13,18 @@
#
#
+my $this_is_510 = $^V ge v5.10.0;
+
use Thread ();
+if ($this_is_510) {
+ eval {require threads::shared};
+}
my $numChilds;
+if ($this_is_510) {
+ eval { threads::shared::share($numChilds) };
+}
+
my $regExpLock = @ARGV ? 1 : 0;
# Repeat generating a random number and check if it contains the
diff -ruad Net-Daemon/t/threadm.t Net-Daemon-fixed/t/threadm.t
--- Net-Daemon/t/threadm.t 2010-03-12 14:38:33.000000000 -0800
+++ Net-Daemon-fixed/t/threadm.t 2010-03-12 14:47:19.000000000 -0800
@@ -24,7 +24,6 @@
exit 0;
}
-
my($handle, $port);
if (@ARGV) {
$port = shift @ARGV;