Front page | perl.perl5.porters |
Postings from December 2010
[perl #80764] "open FH, '<:raw', $filehandle" makes filehandle unbuffered
From:
perlbug-followup
Date:
December 15, 2010 00:57
Subject:
[perl #80764] "open FH, '<:raw', $filehandle" makes filehandle unbuffered
Message ID:
rt-3.6.HEAD-17624-1292356316-341.80764-75-0@perl.org
# New Ticket Created by (none)
# Please include the string: [perl #80764]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=80764 >
This is a bug report for perl from leon@leon-laptop.(none),
generated with the help of perlbug 1.39 running under perl 5.12.1.
-----------------------------------------------------------------
Opening a file with :raw doesn't work as documented. It opens the file with only the :unix layer, without a perlio layer, hence it will be unbuffered. Opening a file without a specific mode and using binmode later does give the correct result. I've could replicate this bug on 5.8.9, 5.10.1, 5.12.1 and blead.
Example code:
use Data::Dumper;
use PerlIO;
#works incorrectly
open my $fh, '<:raw', $0;
print Dumper([ PerlIO::get_layers($fh) ]);
#got: [ 'unix' ]
#expected: [ 'unix', 'perlio' ]
#works correctly
open my $fh2, '<', $0;
binmode $fh2, ':raw';
print Dumper([ PerlIO::get_layers($fh2) ]);
#got: [ 'unix', 'perlio' ]
#expected: [ 'unix', 'perlio' ]
-----------------------------------------------------------------
---
Flags:
category=core
severity=medium
---
Site configuration information for perl 5.12.1:
Configured by leon at Fri Aug 20 20:56:31 EEST 2010.
Summary of my perl5 (revision 5 version 12 subversion 1) configuration:
Platform:
osname=linux, osvers=2.6.32-24-generic, archname=x86_64-linux
uname='linux leon-laptop 2.6.32-24-generic #41-ubuntu smp thu aug 19 01:38:40 utc 2010 x86_64 gnulinux '
config_args='-de -Dprefix=/home/leon/perl5/perlbrew/perls/perl-5.12.1'
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.4.3', 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 /usr/lib /lib64 /usr/lib64
libs=-lnsl -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.11.1.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.11.1'
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.12.1:
/home/leon/perl5/perlbrew/perls/perl-5.12.1/lib/site_perl/5.12.1/x86_64-linux
/home/leon/perl5/perlbrew/perls/perl-5.12.1/lib/site_perl/5.12.1
/home/leon/perl5/perlbrew/perls/perl-5.12.1/lib/5.12.1/x86_64-linux
/home/leon/perl5/perlbrew/perls/perl-5.12.1/lib/5.12.1
.
---
Environment for perl 5.12.1:
HOME=/home/leon
LANG=en_US.utf8
LANGUAGE=en_US:en_GB:en
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/leon/perl5/perlbrew/bin:/home/leon/perl5/perlbrew/perls/current/bin:/home/leon/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
PERL_BADLANG (unset)
SHELL=/bin/bash
-
[perl #80764] "open FH, '<:raw', $filehandle" makes filehandle unbuffered
by perlbug-followup