develooper Front page | perl.perl5.porters | Postings from March 2000

autoviv bug in array handles

Thread Next
From:
Tom Christiansen
Date:
March 20, 2000 07:13
Subject:
autoviv bug in array handles
Message ID:
29367.953565189@chthon
This is what's making everything go completely screwy.  I don't
know where it's autovivving, but it's *not* in the array element.
I wish I knew where it scribbled.

    fileno GLOB(0xf6210) is 3
    length of fh array is 0
    fileno GLOB(0xf6210) is 3
    length of fh array is 0
    fileno GLOB(0xf6210) is 3
    length of fh array is 0

It looks like it's not extending the array when you autoviv something
that's an array element.  And it's reusing the same glob, too.  Plus
it just gets worse from there.  For a truly fun time, try running
this under the debugger.  This "can't call main::GLOB()" thing it
because it's doing some string interp somewhere it oughtn'y.

I've got the patch ready I wanted to have ready, but this one I'm
going to leave for Nick or Sarathy, since I believe this is their
code.  It is vaguely possible that something in my next patch could
fix this, but I believe that something else is more seriously
incorrect, and that it should be addresed elsewhere, not bandaided.

--tom

open($fh[0], "< /etc/motd") || die "can't open /etc/motd: $!";
$fd = fileno($fh[0]);
printf "fileno $fh[0] is %s\n", (defined($fd) ? $fd : "UNDEF");

print "length of fh array is ", scalar @fh, "\n";

open($fh[1], "< /etc/motd") || die "can't open /etc/motd: $!";
$fd = fileno($fh[1]);
printf "fileno $fh[1] is %s\n", (defined($fd) ? $fd : "UNDEF");
print "length of fh array is ", scalar @fh, "\n";

open($fh[2], "< /etc/motd") || die "can't open /etc/motd: $!";
$fd = fileno($fh[2]);
printf "fileno $fh[2] is %s\n", (defined($fd) ? $fd : "UNDEF");
print "length of fh array is ", scalar @fh, "\n";

open($fh0, "< /etc/motd") || die "can't open /etc/motd: $!";
$fd = fileno($fh0);
printf "fileno $fh0 is %s\n", (defined($fd) ? $fd : "UNDEF");

open($fh1, "< /etc/motd") || die "can't open /etc/motd: $!";
$fd = fileno($fh1);
printf "fileno $fh1 is %s\n", (defined($fd) ? $fd : "UNDEF");

open($fh2, "< /etc/motd") || die "can't open /etc/motd: $!";
$fd = fileno($fh2);
printf "fileno $fh2 is %s\n", (defined($fd) ? $fd : "UNDEF");

for $fh ( @fh[0..2], $fh0, $fh1, $fh2 ) {
    close($fh) || warn "can't close $fh: $!";
} 

Thread Next


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