$ ./perl t/TEST ../cpan/Test-Simple/t/subtest/bail_out.t
t/../cpan/Test-Simple/t/subtest/bail_out ... Use of uninitialized value in open at /Users/sprout/Perl/perl.git-copy/cpan/Test-Simple/../../lib/Test/Builder.pm line 1895.
ok
All tests successful.
u=0.01 s=0.00 cu=0.09 cs=0.01 scripts=1 tests=2
Notice the uninitialized value.
$ ./perl -Ilib -Mwarnings=uninitialized -e 'open $fh, ">>", \$x'
Use of uninitialized value $x in open at -e line 1.
$ perl5.18.1 -Mwarnings=uninitialized -e 'open $fh, ">>", \$x'
I caused that in v5.19.5-44-g5a2bc23:
$ ../perl.git/Porting/bisect.pl --start=
045071eede --end=blead -e 'use warnings FATAL=>"uninitialized"; open $fh, ">>", \$x'
...
5a2bc23bfe5dc60ff957cb44ffaa57668d56d238 is the first bad commit
commit
5a2bc23bfe5dc60ff957cb44ffaa57668d56d238
Author: Father Chrysostomos <sprout@cpan.org>
Date: Fri Oct 25 06:15:30 2013 -0700
Better fix for #119529
return -1;
}
if ((PerlIOBase(f)->flags) & PERLIO_F_APPEND)
- s->posn = sv_len(s->var);
+ s->posn = SvOK(s->var) ? sv_len(s->var) : 0;
else
s->posn = 0;
SvSETMAGIC(s->var);
$| = 1;
-use Test::More tests => 113;
+use Test::More tests => 114;
my $fh;
my $var = "aaa\n";
print $fh "foo";
close $fh;
is($warn, 0, "no warnings when writing to an undefined scalar");
+ undef $scalar;
+ open $fh, '>>', \$scalar;
+ print $fh "oof";
+ close $fh;
+ is($warn, 0, "no warnings when appending to an undefined scalar");
}
{