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

[perl #118957] Filehandle Leak With Wrong binmode

Thread Previous
From:
shlomif @ shlomifish . org
Date:
July 21, 2013 15:56
Subject:
[perl #118957] Filehandle Leak With Wrong binmode
Message ID:
rt-3.6.HEAD-2552-1374422189-1170.118957-75-0@perl.org
# New Ticket Created by  shlomif@shlomifish.org 
# Please include the string:  [perl #118957]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118957 >



This is a bug report for perl from shlomif@iglu.org.il,
generated with the help of perlbug 1.39 running under perl 5.18.0.


-----------------------------------------------------------------
[Please describe your issue here]

The following program (when run on Mageia Linux x86-64 Cauldron using
perl-5.18.0 from perlbrew and on other systems other people tried
on IRC) results at "Too many open files at hv.pl line 2."

for my $x (1 .. 10000) {
    open my $temp, '>', "/tmp/t" or die "$!";
    binmode $temp, ":unix";
    close $temp;
}

The problem is due to the «binmode $temp, ":unix";» which is wrong, but should
be handled more carefully.

This was reported by ais523 on Freenode's #perl, so thanks go to him/her.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.18.0:

Configured by shlomif at Fri May 24 18:23:32 IDT 2013.

Summary of my perl5 (revision 5 version 18 subversion 0) configuration:
   
  Platform:
    osname=linux, osvers=3.8.13-desktop-1.mga3, archname=x86_64-linux
    uname='linux telaviv1.shlomifish.org 3.8.13-desktop-1.mga3 #1 smp tue may
14 19:05:25 utc 2013 x86_64 x86_64 x86_64 gnulinux ' config_args='-de
-Dprefix=/home/shlomif/apps/perl/brew/perls/perl-5.18.0
-Aeval:scriptdir=/home/shlomif/apps/perl/brew/perls/perl-5.18.0/bin'
hint=recommended, useposix=true, d_sigaction=define useithreads=undef,
usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define,
usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2', cppflags='-fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include' ccversion='', gccversion='4.7.2', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8 alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.17.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.17'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib
-fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.18.0:
    /home/shlomif/apps/perl/modules/lib/perl5/site_perl/5.18.0
    /home/shlomif/apps/perl/modules/lib/perl5/site_perl/5.16.3
    /home/shlomif/apps/perl/modules/lib/site_perl/5.18.0
    /home/shlomif/apps/perl/modules/lib/site_perl/5.16.3
    /home/shlomif/apps/perl/modules/lib/perl5/5.18.0
    /home/shlomif/apps/perl/modules/lib/perl5/5.16.3
    /home/shlomif/apps/perl/brew/perls/perl-5.18.0/lib/site_perl/5.18.0/x86_64-linux
    /home/shlomif/apps/perl/brew/perls/perl-5.18.0/lib/site_perl/5.18.0
    /home/shlomif/apps/perl/brew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux
    /home/shlomif/apps/perl/brew/perls/perl-5.18.0/lib/5.18.0
    .

---
Environment for perl 5.18.0:
    HOME=/home/shlomif
    LANG=en_GB.UTF-8
    LANGUAGE=en_GB:en
    LC_ADDRESS=en_US.UTF-8
    LC_COLLATE=en_US.UTF-8
    LC_CTYPE=en_US.UTF-8
    LC_IDENTIFICATION=en_GB.UTF-8
    LC_MEASUREMENT=en_GB.UTF-8
    LC_MESSAGES=en_US.UTF-8
    LC_MONETARY=en_US.UTF-8
    LC_NAME=en_GB.UTF-8
    LC_NUMERIC=en_GB.UTF-8
    LC_PAPER=en_US.UTF-8
    LC_SOURCED=1
    LC_TELEPHONE=en_US.UTF-8
    LC_TIME=en_GB.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/shlomif/apps/perl/brew/bin:/home/shlomif/apps/perl/brew/perls/perl-5.18.0/bin:/home/shlomif/apps/gwenview/bin:/home/shlomif/apps/perl/modules/local/bin:/home/shlomif/apps/perl/modules/bin:/opt/valgrind-trunk/bin:/home/shlomif/apps/latemp/bin:/home/shlomif/apps/quadpres/bin:/home/shlomif/apps/wml/bin:/home/shlomif/bin:/home/shlomif/bin:/home/shlomif/apps/gwenview/bin:/usr/local/bin:/usr/bin:/usr/games:/usr/lib64/qt4/bin
    PERL5LIB=/home/shlomif/apps/perl/modules/lib/perl5/site_perl/5.18.0:/home/shlomif/apps/perl/modules/lib/perl5/site_perl/5.16.3:/home/shlomif/apps/perl/modules/lib/site_perl/5.18.0:/home/shlomif/apps/perl/modules/lib/site_perl/5.16.3:/home/shlomif/apps/perl/modules/lib/perl5/5.18.0:/home/shlomif/apps/perl/modules/lib/perl5/5.16.3
    PERLBREW_BASHRC_VERSION=0.58
    PERLBREW_HOME=/home/shlomif/.perlbrew
    PERLBREW_MANPATH=/home/shlomif/apps/perl/brew/perls/perl-5.18.0/man
    PERLBREW_PATH=/home/shlomif/apps/perl/brew/bin:/home/shlomif/apps/perl/brew/perls/perl-5.18.0/bin
    PERLBREW_PERL=perl-5.18.0
    PERLBREW_ROOT=/home/shlomif/apps/perl/brew
    PERLBREW_VERSION=0.64
    PERL_AUTOINSTALL=--skipdeps --alldeps
    PERL_BADLANG (unset)
    PERL_MM_USE_DEFAULT=1
    SHELL=/bin/bash


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