On Fri Aug 30 12:46:31 2013, alh wrote: > On Fri, Aug 30, 2013 at 1:48 PM, Ed Avis <perlbug-followup@perl.org> wrote: > > > > > This causes perl to hang chewing CPU: > > > > my $x = \42; > > open my $fh, "<", \$x; > > my $got = <$fh>; > > > > > This seems to be in sv.c, in Perl_sv_gets, in the loop starting here, at > least for me: > > 8097 for (;;) { > 8098 screamer: > 8099 if (cnt > 0) { > 8100 if (rslen) { > 8101 while (cnt > 0) { /* this | > eat */ > 8102 cnt--; > 8103 if ((*bp++ = *ptr++) == rslast) /* really | > dust */ > 8104 goto thats_all_folks; /* screams | > sed :-) */ > 8105 } > 8106 } > 8107 else { > 8108 Copy(ptr, bp, cnt, char); /* this | > eat */ > 8109 bp += cnt; /* screams | > dust */ > 8110 ptr += cnt; /* louder | > sed :-) */ > 8111 cnt = 0; > 8112 assert (!shortbuffered); > 8113 goto cannot_be_shortbuffered; > 8114 } > 8115 } > 8116 > > I haven't chased it any further. I didn't see it on perl-5.10.1, but I do > see it on perl-5.14.2. > > -- Matthew Horsfall (alh) $ ../perl.git/Porting/bisect.pl --start=v5.10.0 --end=v5.12.4 -e 'alarm 1; my $x = \42; open my $fh, "<", \$x; my $got = <$fh>;' ... 30c16bb48be7651b70d0995a08678033f9a5e942 is the first bad commit commit 30c16bb48be7651b70d0995a08678033f9a5e942 Author: David Mitchell <davem@iabyn.com> Date: Wed May 5 22:39:24 2010 +0100 RT 43789: "in memory" files don't call STORE The code in PerlIO-scalar that implements the open $fh, '>' \$buffer feature did not, apart from accidentally, support get/set magic and thus tied buffers. This patch remedies that: mostly by just blindly sprinkling SvGETMAGIC/SvSETMAGIC about, rather than doing any deep analysis and understanding of the code. One main change I did was to add a PerlIOScalar_read() function, rather than rely on the default behaviour (which implements it in terms of PerlIOScalar_get_ptr() etc), since that approach had a tendency to call FETCH multiple times -- Father Chrysostomos --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=119529Thread Previous