develooper Front page | perl.perl5.porters | Postings from November 2010

[perl #78844] binmode clobbers $@ under certain circumstances

Thread Next
From:
muir @ arubanetworks . com
Date:
November 5, 2010 21:51
Subject:
[perl #78844] binmode clobbers $@ under certain circumstances
Message ID:
rt-3.6.HEAD-4263-1288994372-238.78844-75-0@perl.org
# New Ticket Created by  muir@arubanetworks.com 
# Please include the string:  [perl #78844]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=78844 >



This is a bug report for perl from muir@arubanetworks.com,
generated with the help of perlbug 1.39 running under perl 5.10.1.


-----------------------------------------------------------------

binmode() can clobber $@ under certain circumstances. This reproduces it:

$@ = 'foo';

open(my $fh, '>/tmp/foo');
binmode($fh, ':encoding(UTF-8)');

warn $@;

Note that setting the binmode to ':raw' does not clobber $@. 

If this turns out to not be a bug for some reason, the perldoc for binmode
should mention this behavior.

In case you are curious, the first symptom I saw was die() being unusually
silent (but still exiting the program). We had an object with a DESTROY
method hitting binmode in this way, which of course clobbered the exception
after it was thrown but before it was output to STDERR.

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

Configured by Red Hat, Inc. at Tue Jun 29 15:55:54 PDT 2010.

Summary of my perl5 (revision 5 version 10 subversion 1) configuration:
   
  Platform:
    osname=linux, osvers=2.6.18-194.3.1.el5, archname=x86_64-linux-thread-multi
    uname='linux kilo.corp.airwave.com 2.6.18-194.3.1.el5 #1 smp thu may 13 13:08:30 edt 2010 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Doptimize=-O2 -g -m64 -mtune=generic -Dversion=5.10.1 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dman1dir=/opt/airwave/share/man/man1 -Dman3dir=/opt/airwave/share/man/man3 -Dcf_by=Red Hat, Inc. -Dinstallprefix=/opt/airwave -Dprefix=/opt/airwave -Dlibpth=/usr/lib64 /lib64 /opt/airwave/lib64 /usr/lib /lib /opt/airwave/lib -Dprivlib=/opt/airwave/lib/perl5/5.10.1 -Dsitelib=/opt/airwave/local/lib/perl5/site_perl/5.10.1 -Dvendorlib=/opt/airwave/lib/perl5/vendor_perl/5.10.1 -Darchlib=/opt/airwave/lib64/perl5/5.10.1/x86_64-linux-thread-multi -Dsitearch=/opt/airwave/local/lib64/perl5/site_perl/5.10.1/x86_64-linux-thread-multi -Dvendorarch=/opt/airwave/lib64/perl5/vendor_perl/5.10.1/x86_64-linux-thread-multi -Dotherlibdirs=/opt/airwave/local/lib/perl5/site_perl/5.10.0:/opt/airwave/lib/perl5/vendor_perl/5.10.0 -Darchname=x86_64-linux-thread-multi -Dvendorprefix=/opt/airwave -Dsiteprefix=/opt/airwave/local -Duseshrplib -Dusethreads -Duseithreads -D
 uselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/opt/airwave/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g -m64 -mtune=generic',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-48)', 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='gcc', ldflags =' -fstack-protector'
    libpth=/usr/lib64 /lib64 /opt/airwave/lib64 /usr/lib /lib /opt/airwave/lib
    libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.5.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/opt/airwave/lib64/perl5/5.10.1/x86_64-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -m64 -mtune=generic -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.10.1:
    /root/svn/mercury/lib/perl
    /root/svn/devtoys/rally/lib
    /root/svn/devtoys/bug_emails
    /root/svn/devtoys/farm
    /opt/airwave/lib64/perl5/5.10.1/x86_64-linux-thread-multi
    /opt/airwave/lib/perl5/5.10.1
    /opt/airwave/local/lib64/perl5/site_perl/5.10.1/x86_64-linux-thread-multi
    /opt/airwave/local/lib/perl5/site_perl/5.10.1
    /opt/airwave/local/lib/perl5/site_perl/5.10.0
    /opt/airwave/local/lib/perl5/site_perl
    /opt/airwave/lib64/perl5/vendor_perl/5.10.1/x86_64-linux-thread-multi
    /opt/airwave/lib/perl5/vendor_perl/5.10.1
    /opt/airwave/lib/perl5/vendor_perl/5.10.0
    /opt/airwave/lib/perl5/vendor_perl
    /opt/airwave/local/lib/perl5/site_perl/5.10.0
    /opt/airwave/lib/perl5/vendor_perl/5.10.0
    .

---
Environment for perl 5.10.1:
    HOME=/root
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/opt/airwave/local/bin:/opt/airwave/bin:/usr/local/sbin:/root/svn/mercury/bin:/usr/local/airwave/bin:/usr/java/jre/bin:/usr/java/jdk/bin:/var/airwave/support:/opt/condor/sbin:/opt/condor/bin:/opt/flex/bin:/opt/ant/bin:/usr/sbin:/sbin:/usr/local/bin::/usr/kerberos/sbin:/usr/kerberos/bin:/bin:/usr/bin:/root/bin
    PERL5LIB=/root/svn/mercury/lib/perl:/root/svn/devtoys/rally/lib:/root/svn/devtoys/bug_emails:/root/svn/devtoys/farm
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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