[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
[perl #59550] readline returns EBADF at eof in 5.10.0
# New Ticket Created by Mark Martinec
# Please include the string: [perl #59550]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59550 >
This is a bug report for perl from Mark.Martinec@ijs.si,
generated with the help of perlbug 1.36 running under perl 5.10.0.
-----------------------------------------------------------------
The readline() function (or a diamond I/O operator <>) returns
a EBADF (Bad file descriptor) as its errno status on end-of-file
when PERLIO is set to "stdio" (which unfortunately is a default
setting in some Linux distributions).
The situation worsened with 5.10.0 (compared to 5.8.8):
$ echo "test" | PERLIO="stdio" perl5.8.8 -e \
'for($!=0; <>; $!=0){print}; $!==0 or die "Err: $!"'
test
$ echo "test" | PERLIO="stdio" perl5.10.0 -e \
'for($!=0; <>; $!=0){print}; $!==0 or die "Err: $!"'
test
Err: Bad file descriptor at -e line 1, <> line 1.
This used to be an issue only on some Linux distributions
and not on FreeBSD. Now with 5.10.0 it happens here too.
The problem only occurs with PERLIO="stdio", not with an
unset PERLIO or with PERLIO="perlio".
The bug lures application programmers to ignore I/O status,
which is a bad programming practice and can lead to
hard-to-diagnose secondary application failures.
This is causing grief in at least two projects currently.
It would be really nice to get the status reporting right.
Btw, it is a probably related to bug #39060 (regarding non-NL
terminated last line), although missing last NL adds it own
quirk and perhaps still merits its own bug entry.
Now even with PERLIO="perlio" (or unset):
# line terminated with a NL
$ echo "test" | perl5.10.0 -e \
'for($!=0; <>; $!=0){print}; $!==0 or die "Err:$!"'
test
# line not terminated with a NL
$ echo -n "test" | perl5.10.0 -e \
'for($!=0; <>; $!=0){print}; $!==0 or die "Err:$!"'
Err:Bad file descriptor at -e line 1, <> line 1.
test
-----------------------------------------------------------------
---
Flags:
category=core
severity=medium
---
Site configuration information for perl 5.10.0:
Configured by mark at Fri Sep 26 14:12:03 UTC 2008.
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=freebsd, osvers=7.0-release-p1, archname=amd64-freebsd
uname='freebsd neli-virtual.ijs.si 7.0-release-p1 freebsd 7.0-release-p1 #0: sun jun 1 03:02:30 cest 2008
lesi@neli.ijs.si:usrobjusrsrcsysneli amd64 '
config_args='-ds -e'
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 ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include',
optimize='-O',
cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='4.2.1 20070719 [FreeBSD]', 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 ='-Wl,-E -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt -lutil -lc
perllibs=-lm -lcrypt -lutil -lc
libc=, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl 5.10.0:
/usr/local/lib/perl5/5.10.0/amd64-freebsd
/usr/local/lib/perl5/5.10.0
/usr/local/lib/perl5/site_perl/5.10.0/amd64-freebsd
/usr/local/lib/perl5/site_perl/5.10.0
/usr/local/lib/perl5/site_perl/5.6.2.OFF
/usr/local/lib/perl5/site_perl
.
---
Environment for perl 5.10.0:
HOME=/root
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/local/zenoss/bin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
PERL_BADLANG (unset)
SHELL=/usr/local/bin/bash
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]