> [EMAIL PROTECTED] - Tue May 30 02:05:20 2000]:
> 
> This is a bug report for perl from [EMAIL PROTECTED],
> generated with the help of perlbug 1.26 running under perl 5.00503.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> 
> local (*DH);
> opendir(DH, '.');
> 
> The dirhandle doesn't seem to close when DH goes out of scope and chews up
> a file descriptor.  Eventually, I run out of file descriptors.
> 
> Also, fileno DH doesn't work.
> 

Looking at the following strace, I just do not see that the close is not
occuring.

#!/usr/bin/perl -w
use strict;
print "pid:  $$\n";
{
    local (*DH);
    opendir(DH, '.');
}
print "Out of scope\n";


Below is the end (and important part) of the strace output.
write(1, "pid:  29825\n", 12pid:  29825
)           = 12
open("/dev/null", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = -1 ENOTDIR (Not a
directory)
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 3
fstat64(3, {st_mode=S_IFDIR|0777, st_size=3824, ...}) = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
close(3)                                = 0
write(1, "Out of scope\n", 13Out of scope
)          = 13
exit_group(0)                           = ?


The open on the directory returns an fd of 3.  Before "Out of scope" is
printed, a close(3) is performed.  I don't know if this was fixed with
the PerlIO changes, but it doesn't appear to be a problem now.



Reply via email to