develooper Front page | perl.perl5.porters | Postings from June 2012

[perl #113864] sysopen() fails to open file larger than 2**32 bytes

Thread Previous
From:
Villek
Date:
June 29, 2012 03:53
Subject:
[perl #113864] sysopen() fails to open file larger than 2**32 bytes
Message ID:
rt-3.6.HEAD-28836-1340793310-1864.113864-75-0@perl.org
# New Ticket Created by  Villek 
# Please include the string:  [perl #113864]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=113864 >


This is a bug report for perl from villek@matrixscience.com,
generated with the help of perlbug 1.39 running under perl 5.14.2.


-----------------------------------------------------------------
When I try to sysopen() a file larger than 2**32 bytes on
Windows 7 x64, using ActivePerl 5.14.2 (64-bit), I get an "Invalid
argument" error. I can open() the same file without problems.

The same problem persists on Windows Server 2003 and Server 2008
(using ActivePerl 5.14.2 -- both 32-bit and 64-bit -- and ActivePerl
5.12.4 (64-bit)), as well as on Windows 7 x64 using Strawberry Perl
5.14.2 (64-bit). It is for this reason that it seems to be a bug in
Perl core itself.

It's easy to reproduce (the first command creates an empty file of
the appropriate size -- ensure you have at least 4 GB free disk
space):

C:\Users\villek>perl -e "open(my $fh, '>', 'test.file') or die $!;
  truncate($fh, 2**32+1) or die $!"

C:\Users\villek>perl -MFcntl -e "sysopen(my $fh, 'test.file', O_RDWR
  | O_CREAT) or die $!; print -s $fh"
Invalid argument at -e line 1.

C:\Users\villek>perl -e "open(my $fh, '+>>', 'test.file') or die $!;
  print -s $fh"
4294967297

Expected result: the second and third command should open the file
successfully and print the same file size (2**32 + 1 = 4294967297).


-----------------------------------------------------------------
---
Flags:
     category=core
     severity=medium
---
Site configuration information for perl 5.14.2:

Configured by sshd_server at Fri Oct  7 15:14:49 2011.

Summary of my perl5 (revision 5 version 14 subversion 2) configuration:

   Platform:
     osname=MSWin32, osvers=5.2, archname=MSWin32-x64-multi-thread
     uname=''
     config_args='undef'
     hint=recommended, useposix=true, d_sigaction=undef
     useithreads=define, usemultiplicity=define
     useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
     use64bitint=define, use64bitall=undef, uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -Ox -GL 
-fp:precise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE 
-DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT 
-DPERL_IMPLICIT_SYS -DUSE_PERLIO',
     optimize='-MD -Zi -DNDEBUG -Ox -GL -fp:precise',
     cppflags='-DWIN32'
     ccversion='14.00.40310.41', gccversion='', gccosandvers=''
     intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678
     d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
     ivtype='__int64', ivsize=8, nvtype='double', nvsize=8, 
Off_t='__int64', lseeksize=8
     alignbytes=8, prototype=define
   Linker and Libraries:
     ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf 
-ltcg  -libpath:"C:\Perl64\lib\CORE"  -machine:AMD64'
     libpth=\lib
     libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib 
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib 
odbc32.lib odbccp32.lib comctl32.lib bufferoverflowU.lib msvcrt.lib
     perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib 
version.lib odbc32.lib odbccp32.lib comctl32.lib bufferoverflowU.lib 
msvcrt.lib
     libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl514.lib
     gnulibc_version=''
   Dynamic Linking:
     dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
     cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug 
-opt:ref,icf -ltcg  -libpath:"C:\Perl64\lib\CORE"  -machine:AMD64'

Locally applied patches:
     ACTIVEPERL_LOCAL_PATCHES_ENTRY

---
@INC for perl 5.14.2:
     C:/Perl64/site/lib
     C:/Perl64/lib
     .

---
Environment for perl 5.14.2:
     HOME (unset)
     LANG (unset)
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
 
PATH=C:\Perl64\site\bin;C:\Perl64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
     PERL_BADLANG (unset)
     SHELL (unset)


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About