develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl #24225] [5.8.1] segfault in binmode STDOUT, ':stdio'; print 1

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
October 20, 2003 05:05
Subject:
Re: [perl #24225] [5.8.1] segfault in binmode STDOUT, ':stdio'; print 1
Message ID:
20031020120508.2513.12@llama.elixent.com
Stas Bekman <perl5-porters@perl.org> writes:
># New Ticket Created by  Stas Bekman 
># Please include the string:  [perl #24225]
># in the subject line of all future correspondence about this issue. 
># <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24225 >
>
>
>
>
>This is a bug report for perl from stas@stason.org,
>generated with the help of perlbug 1.34 running under perl v5.8.1.
>
>
>-----------------------------------------------------------------
>[Please enter your report here]
>
>% perl-5.8.1 -wle "binmode STDOUT, ':stdio'; print 1"
>Segmentation fault
>
>The same problem appears with blead perl, but not with 5.8.0.

Confirmed. Something odd is going on...
You are not supposed to get to the else branch on line 2640 if
stream is already stdio. 

That said blindly de-refing mode is not good.

>
>#0  0x40123024 in PerlIOStdio_mode (mode=0x0,
>     tmode=0xbffff208 "ØÒ\001@0×\b@$òÿ¿\001") at perlio.c:2616
>2616        while (*mode) {
>(gdb) where
>#0  0x40123024 in PerlIOStdio_mode (mode=0x0,
>     tmode=0xbffff208 "ØÒ\001@0×\b@$òÿ¿\001") at perlio.c:2616
>#1  0x401230e9 in PerlIOStdio_pushed (f=0x8054900, mode=0x0,
>arg=0x40157618,
>     tab=0x40155a60) at perlio.c:2640
>#2  0x4012086d in PerlIO_push (f=0x8054900, tab=0x40155a60, mode=0x0,
>     arg=0x40157618) at perlio.c:1165
>#3  0x40120abc in PerlIO_apply_layera (f=0x8054900, mode=0x0,
>     layers=0x8054ad8, n=0, max=1) at perlio.c:1248
>#4  0x40120b3c in PerlIO_apply_layers (f=0x8054900, mode=0x0,
>     names=0x805d310 ":stdio") at perlio.c:1266
>#5  0x40120bbf in PerlIO_binmode (f=0x8054900, iotype=62, mode=0,
>     names=0x805d310 ":stdio") at perlio.c:1291
>#6  0x400eae56 in Perl_pp_binmode () at pp_sys.c:755
>#7  0x4008d1f4 in Perl_runops_debug () at dump.c:1434
>#8  0x400383c4 in S_run_body (oldscope=1) at perl.c:1829
>#9  0x40037e81 in perl_run (my_perl=0x804baf8) at perl.c:1748
>#10 0x080492b2 in main (argc=3, argv=0xbffff504, env=0xbffff514)
>     at perlmain.c:86
>#11 0x401ebc57 in __libc_start_main () from /lib/i686/libc.so.6
>
>
>[Please do not change anything below this line]
>-----------------------------------------------------------------
>---
>Flags:
>     category=core
>     severity=medium
>---
>Site configuration information for perl v5.8.1:
>
>Configured by stas at Thu Sep 25 19:12:52 PDT 2003.
>
>Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration:
>   Platform:
>     osname=linux, osvers=2.4.21-0.18mdkcustom, archname=i686-linux
>     uname='linux rabbit.stason.org 2.4.21-0.18mdkcustom #6 mon jun 16 
>16:26:34 est 2003 i686 unknown unknown gnulinux '
>     config_args='-des -Dprefix=/home/stas/perl/5.8.1 -Doptimize=-g 
>-Duseshrplib -Dusedevel'
>     hint=recommended, useposix=true, d_sigaction=define
>     usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
>     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
>     use64bitint=undef use64bitall=undef uselongdouble=undef
>     usemymalloc=n, bincompat5005=undef
>   Compiler:
>     cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include 
>-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
>     optimize='-g',
>     cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include 
>-I/usr/include/gdbm'
>     ccversion='', gccversion='3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)', 
>gccosandvers=''
>     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
>     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
>     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
>lseeksize=8
>     alignbytes=4, prototype=define
>   Linker and Libraries:
>     ld='cc', ldflags =' -L/usr/local/lib'
>     libpth=/usr/local/lib /lib /usr/lib
>     libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
>     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
>     libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so
>     gnulibc_version='2.3.2'
>   Dynamic Linking:
>     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic 
>-Wl,-rpath,/home/stas/perl/5.8.1/lib/5.8.1/i686-linux/CORE'
>     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
>
>Locally applied patches:
>
>
>---
>@INC for perl v5.8.1:
>     /home/stas/perl/5.8.1/lib/5.8.1/i686-linux
>     /home/stas/perl/5.8.1/lib/5.8.1
>     /home/stas/perl/5.8.1/lib/site_perl/5.8.1/i686-linux
>     /home/stas/perl/5.8.1/lib/site_perl/5.8.1
>     /home/stas/perl/5.8.1/lib/site_perl
>     .
>
>---
>Environment for perl v5.8.1:
>     HOME=/home/stas
>     LANG=en_AU
>     LANGUAGE=en_AU:en_US:en
>     LC_ADDRESS=en_AU
>     LC_COLLATE=en_AU
>     LC_CTYPE=en_AU
>     LC_IDENTIFICATION=en_AU
>     LC_MEASUREMENT=en_AU
>     LC_MESSAGES=en_AU
>     LC_MONETARY=en_AU
>     LC_NAME=en_AU
>     LC_NUMERIC=en_AU
>     LC_PAPER=en_AU
>     LC_TELEPHONE=en_AU
>     LC_TIME=en_AU
>     LD_LIBRARY_PATH (unset)
>     LOGDIR (unset)
> 
>PATH=/usr//bin:/bin:/usr/bin:.:/usr/local/bin:/usr/X11R6/bin:/usr/games:/home/stas/bin:/home/stas/bin:/usr/local/bin:/usr/X11R6/bin:/usr/java/j2re1.4.0/bin/
>     PERLDOC_PAGER=less -R
>     PERL_BADLANG (unset)
>     SHELL=/bin/tcsh
>
>__________________________________________________________________
>Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
>http://stason.org/     mod_perl Guide ---> http://perl.apache.org
>mailto:stas@stason.org http://use.perl.org http://apacheweek.com
>http://modperlbook.org http://apache.org   http://ticketmaster.com


Thread Previous | 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