Closed p5pRT closed 12 years ago
% perl -wle 'my $x = *{*STDIN{IO}}; defined $x && $x eq "" or die 1; $x and die 2;' 2 at -e line 1.
=> $x is the empty string\, yet true
% perl -wle 'my $x = *{*STDIN{IO}}; defined $x && $x eq "" or die 1; print "[$x]"' []
=> $x is an ordinary (defined) empty string
% perl -wle 'my $x = *{*STDIN{IO}}; defined $x && $x eq "" or die 1; $x .= ""' Use of uninitialized value $x in concatenation (.) or string at -e line 1.
=> $x is defined() and undef at the same time
Even better\, .= normally doesn't warn about an uninitialized LHS!
I don't know what the intended behavior of *{*STDIN{IO}} is but this is probably not it.
% perl -wle 'my $x = *{*STDIN{IO}}; defined $x&& $x eq "" or die 1; $x and die 2;' 2 at -e line 1.
This behaves correctly on 5.8.x. On 5.10\, it segfaults - a debugging 5.10.1 gives the following assertion failure :
Assertion ((buffer)->sv_flags & 0x00000400) failed: file "sv.c"\, line 1859 at -e line 1.
It starts failing on perl 5.12.
Vincent.
The RT System itself - Status changed from 'new' to 'open'
On Fri Aug 05 02:42:13 2011\, perl@profvince.com wrote:
% perl -wle 'my $x = *{*STDIN{IO}}; defined $x&& $x eq "" or die 1; $x and die 2;' 2 at -e line 1.
This behaves correctly on 5.8.x.
In 5.8.x\, defined(*$io} returns false. For defined to return false on a typeglob seems wrong to me.
On 5.10\, it segfaults - a debugging 5.10.1 gives the following assertion failure :
Assertion \(\(buffer\)\->sv\_flags & 0x00000400\) failed​: file "sv\.c"\,
line 1859 at -e line 1.
It starts failing on perl 5.12.
I donāt know the history\, but I suspect stringification was never taken into account\, hence a string was never provided.
So this special glob stringifies as undef\, which is a contradiction in terms; hence all the bugs.
I would suggest stringifying it as *__ANON__ or *__ANONIO__. (Thereās precedent for the latter in op.c:ck_fun\, but I donāt know how to trigger it.)
On Mon\, Aug 22\, 2011 at 6:38 PM\, Father Chrysostomos via RT \< perlbug-followup@perl.org> wrote:
I would suggest stringifying it as *__ANON__ or *__ANONIO__. (Thereās precedent for the latter in op.c:ck_fun\, but I donāt know how to trigger it.)
perl -we 'my $t = {}; open $t->{fh}\, ">"\, "some_file.txt"; lstat $t->{fh}'
That behavior needs some tests\, I think.
Now fixed with commit 52a6327.
@cpansprout - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#96326 (status was 'resolved')
Searchable as RT96326$