Front page | perl.perl5.porters |
Postings from February 2012
[perl #111352] bad file descriptor after failed read
Thread Next
From:
ian . goodacre @ xtra . co . nz
Date:
February 26, 2012 11:57
Subject:
[perl #111352] bad file descriptor after failed read
Message ID:
rt-3.6.HEAD-4610-1330239228-1913.111352-75-0@perl.org
# New Ticket Created by ian.goodacre@xtra.co.nz
# Please include the string: [perl #111352]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=111352 >
This is a bug report for perl from ian.goodacre@xtra.co.nz,
generated with the help of perlbug 1.39 running under perl 5.12.3.
-----------------------------------------------------------------
[Please describe your issue here]
I was surprised to find that after a failed read on a file descriptor
opened for write, many (but not all) operations on the file descriptor
failed with "bad file descriptor'.
What I expected was that the read would fail (because the file was
opened for write only) but subsequent operations (e.g. close, print,
seek, tell, etc.) would succeed.
Checking with Process Monitor (I saw this behavior on Windows 7), I
did not see any failed operations on the file at the Windows interface,
so I am guessing the bad file descriptor is from perl.
The context where this arose is a subroutine passed a file descriptor. The subroutine
was to determine whether seek and tell worked correctly with the given file
descriptor, so I wanted to read and write data if possible.
The attached test demonstrates the behavior.
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl 5.12.3:
Configured by 1 at Sun May 15 16:53:01 2011.
Summary of my perl5 (revision 5 version 12 subversion 3) configuration:
Platform:
osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
uname='Win32 strawberryperl 5.12.3.0 #1 Sun May 15 09:44:53 2011 i386'
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags =' -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields -DPERL_MSVCRT_READFIX',
optimize='-s -O2',
cppflags='-DWIN32'
ccversion='', gccversion='4.4.3', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"'
libpth=C:\strawberry\c\lib C:\strawberry\c\i686-w64-mingw32\lib
libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
libc=, so=dll, useshrplib=true, libperl=libperl512.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"'
Locally applied patches:
---
@INC for perl 5.12.3:
C:/strawberry/perl/site/lib
C:/strawberry/perl/vendor/lib
C:/strawberry/perl/lib
.
---
Environment for perl 5.12.3:
HOME (unset)
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\x64\;C:\Program Files (x86)\Windows Live\Shared;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\UnxUtils\usr\local\wbin;C:\Java\jdk1.7.0\bin;C:\GTK\bin;C:\Program Files (x86)\mpg123;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL
Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft Visual Studio 9..0\Common7\IDE\PrivateAssemblies\
PERL_BADLANG (unset)
PERL_JSON_BACKEND=JSON::XS
PERL_YAML_BACKEND=YAML
SHELL=C:\strawberry\perl\site\bin\psh.bat
Thread Next
-
[perl #111352] bad file descriptor after failed read
by ian . goodacre @ xtra . co . nz