In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/aab1202a8d4b691b16384fb41d2e2a06abf664e2?hp=3dc046923b29df53d330b0ab9ba42640194b1f51>

- Log -----------------------------------------------------------------
commit aab1202a8d4b691b16384fb41d2e2a06abf664e2
Author: Father Chrysostomos <[email protected]>
Date:   Wed Mar 25 10:33:44 2015 -0700

    [perl #123790] Assert fail with *x=<y>
    
    When assigning undef to its target, readline needs to take into
    account that it might be a typeglob.  sv_setsv knows how handle this,
    but SvOK_off is simply wrong.
    
    This fixes this particular crash, but other issues in the ticket are
    as yet unresolved.
-----------------------------------------------------------------------

Summary of changes:
 pp_hot.c        |  3 +--
 t/op/readline.t | 11 ++++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/pp_hot.c b/pp_hot.c
index f2468f9..67b78f3 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1633,8 +1633,7 @@ Perl_do_readline(pTHX)
        if (gimme == G_SCALAR) {
            /* undef TARG, and push that undefined value */
            if (type != OP_RCATLINE) {
-               SV_CHECK_THINKFIRST_COW_DROP(TARG);
-               SvOK_off(TARG);
+               sv_setsv(TARG,NULL);
            }
            PUSHTARG;
        }
diff --git a/t/op/readline.t b/t/op/readline.t
index dd8d469..bfe90d5 100644
--- a/t/op/readline.t
+++ b/t/op/readline.t
@@ -6,7 +6,7 @@ BEGIN {
     set_up_inc('../lib');
 }
 
-plan tests => 31;
+plan tests => 32;
 
 # [perl #19566]: sv_gets writes directly to its argument via
 # TARG. Test that we respect SvREADONLY.
@@ -275,6 +275,15 @@ is tell, tell *foom, 'readline *$glob_copy sets 
PL_last_in_gv';
 readline undef;
 is ${^LAST_FH}, undef, '${^LAST_FH} after readline undef';
 
+{
+    my $w;
+    local($SIG{__WARN__},$^W) = (sub { $w .= shift }, 1);
+    *x=<y>;
+    like $w, qr/^readline\(\) on unopened filehandle y at .*\n(?x:
+                )Undefined value assigned to typeglob at .*\n\z/,
+        '[perl #123790] *x=<y> used to fail an assertion';
+}
+
 __DATA__
 moo
 moo

--
Perl5 Master Repository

Reply via email to