summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-02-28 15:13:33 +0000
committerDavid Mitchell <davem@iabyn.com>2010-02-28 15:13:33 +0000
commita1f97a07fa8362ead50c8cd62c4ed6bb0066574f (patch)
tree21b9cb8a82f94ca65faca892d025781757b01c2a /t
parent490aa361e2910b6b451cc8bceccd93efa8fbed11 (diff)
downloadperl-a1f97a07fa8362ead50c8cd62c4ed6bb0066574f.tar.gz
fix for [perl #72604] @DB::args and win32 fork
A previous fix for [perl #66108] (7fa38291524c327a3cb23bfe94979e1537743cac) stopped cloning PL_dbargs, on the grounds that it was usually filled with garbage (it contains an un-refcounted copy of @_'s elements; once the function has returned, these may have been freed or reassigned). However, the fix instead recreated PL_dbargs as a new empty AV that *wasn't* then associated with the DB::args glob; so modifications to PL_dbargs weren't seen via @DB::args. The fix is to simply set it to null when cloning; pp_caller() will recreate it again if necessary when it is needed.
Diffstat (limited to 't')
-rw-r--r--t/op/fork.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/op/fork.t b/t/op/fork.t
index 9fe8107cfa..fc9c58fc06 100644
--- a/t/op/fork.t
+++ b/t/op/fork.t
@@ -462,3 +462,21 @@ sub { @_ = 3; fork ? die "1\n" : die "1\n" }->(2);
EXPECT
1
1
+########
+# [perl #72604] @DB::args stops working across Win32 fork
+$|=1;
+sub f {
+ if ($pid = fork()) {
+ print "waitpid() returned ok\n" if waitpid($pid,0) == $pid;
+ }
+ else {
+ package DB;
+ my @c = caller(0);
+ print "child: called as [$c[3](", join(',',@DB::args), ")]\n";
+ exit(0);
+ }
+}
+f("foo", "bar");
+EXPECT
+child: called as [main::f(foo,bar)]
+waitpid() returned ok