develooper Front page | perl.perl5.porters | Postings from August 2013

Re: [perl #119529] Filehandle opened from ref to ref hangs on reading

Thread Previous
From:
wolfsage
Date:
August 30, 2013 19:46
Subject:
Re: [perl #119529] Filehandle opened from ref to ref hangs on reading
Message ID:
CAJ0K8bgyz2tHjOQnQ1-_Gs0ZcHwSt-FyffvzA6ZHiG0iFaoYwg@mail.gmail.com
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)

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About