]>
Commit | Line | Data |
---|---|---|
0d28a5dd | 1 | Change 27368 by rgs@stencil on 2006/03/03 15:45:32 |
2 | ||
3 | Subject: [PATCH] Re: [perl #38657] -d:Foo=bar broke in 5.8.8 | |
4 | From: Jarkko Hietaniemi <jhietaniemi@gmail.com> | |
5 | Date: Thu, 02 Mar 2006 20:21:26 +0200 | |
6 | Message-ID: <440737A6.4060606@gmail.com> | |
7 | ||
8 | Affected files ... | |
9 | ||
10 | ... //depot/perl/t/lib/Devel/switchd.pm#3 edit | |
11 | ... //depot/perl/t/run/switchd.t#4 edit | |
12 | ||
0d28a5dd | 13 | |
a0eeaefb | 14 | Change 27359 by rgs@marais on 2006/03/01 22:39:24 |
15 | ||
16 | Don't put strings with embedded NULs in the environment. | |
17 | This makes things like -d:Foo=bar work again. | |
18 | ||
19 | Affected files ... | |
20 | ||
21 | ... //depot/perl/perl.c#737 edit | |
22 | ||
23 | --- perl.c 2006-03-01 22:18:07.000000000 +0100 | |
24 | +++ perl.c 2006-03-01 22:18:04.000000000 +0100 | |
25 | @@ -3031,7 +3031,9 @@ | |
26 | sv_catpv(sv, start); | |
27 | else { | |
28 | sv_catpvn(sv, start, s-start); | |
29 | - Perl_sv_catpvf(aTHX_ sv, " split(/,/,q%c%s%c)", 0, ++s, 0); | |
30 | + /* Don't use NUL as q// delimiter here, this string goes in the | |
31 | + * environment. */ | |
32 | + Perl_sv_catpvf(aTHX_ sv, " split(/,/,q{%s});", ++s); | |
33 | } | |
34 | s += strlen(s); | |
35 | my_setenv("PERL5DB", SvPV_nolen_const(sv)); | |
0d28a5dd | 36 | --- t/lib/Devel/switchd.pm.dist 2006-03-02 20:02:52.000000000 +0200 |
37 | +++ t/lib/Devel/switchd.pm 2006-03-02 20:12:59.000000000 +0200 | |
38 | @@ -1,6 +1,8 @@ | |
39 | package Devel::switchd; | |
40 | use strict; BEGIN { } # use strict; BEGIN { ... } to incite [perl #21890] | |
41 | +sub import { print "import<@_>;" } | |
42 | package DB; | |
43 | -sub DB { print join(",", caller), ";" } | |
44 | +sub DB { print "DB<", join(",", caller), ">;" } | |
45 | +sub sub { print "sub<$DB::sub>;"; goto &$DB::sub } | |
46 | 1; | |
47 | ||
48 | --- t/run/switchd.t.dist 2006-03-02 19:59:03.000000000 +0200 | |
49 | +++ t/run/switchd.t 2006-03-02 20:17:18.000000000 +0200 | |
50 | @@ -7,7 +7,9 @@ | |
51 | ||
52 | require "./test.pl"; | |
53 | ||
54 | -plan(tests => 1); | |
55 | +# This test depends on t/lib/Devel/switchd.pm. | |
56 | + | |
57 | +plan(tests => 2); | |
58 | ||
59 | my $r; | |
60 | my @tmpfiles = (); | |
61 | @@ -34,7 +36,14 @@ | |
62 | $r = runperl( | |
63 | switches => [ '-Ilib', '-d:switchd' ], | |
64 | progfile => $filename, | |
65 | + args => ['3'], | |
66 | ); | |
67 | - like($r, qr/^main,swdtest.tmp,9;Foo,swdtest.tmp,5;Foo,swdtest.tmp,6;Foo,swdtest.tmp,6;Bar,swdtest.tmp,2;Bar,swdtest.tmp,2;Bar,swdtest.tmp,2;$/i); | |
68 | + like($r, qr/^sub<Devel::switchd::import>;import<Devel::switchd>;DB<main,swdtest.tmp,9>;sub<Foo::foo>;DB<Foo,swdtest.tmp,5>;DB<Foo,swdtest.tmp,6>;DB<Foo,swdtest.tmp,6>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;$/); | |
69 | + $r = runperl( | |
70 | + switches => [ '-Ilib', '-d:switchd=a,42' ], | |
71 | + progfile => $filename, | |
72 | + args => ['4'], | |
73 | + ); | |
74 | + like($r, qr/^sub<Devel::switchd::import>;import<Devel::switchd a 42>;DB<main,swdtest.tmp,9>;sub<Foo::foo>;DB<Foo,swdtest.tmp,5>;DB<Foo,swdtest.tmp,6>;DB<Foo,swdtest.tmp,6>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;sub<Bar::bar>;DB<Bar,swdtest.tmp,2>;$/); | |
75 | } | |
76 |