develooper Front page | perl.perl5.porters | Postings from July 2001

[ID 20010710.006] copy binary file bug

Thread Next
From:
antilyrical
Date:
July 10, 2001 18:03
Subject:
[ID 20010710.006] copy binary file bug
Message ID:
200107110103.f6B13B806067@shelob.julianhaight.com

This is a bug report for perl from antilyrical@spamcop.net,
generated with the help of perlbug 1.33 running under perl v5.6.1.

The program below should copy one binary file
to another filename. The file that is being copyied
is supplied on the commandline. I execute it as
perl -w mysplit2.pl c:\code\test.pdf
The file is slightly over
one megabyte. The file is read 100 bytes
at a time. The problem is that after 360,149 bytes
are copied, the program exits. If I try reading
more or less then 100 bytes at a time, the results
are the same.
The script I am using is below.

Mario
antilyrical@spamcop.net

##############

use strict;
binmode(CHIPP);
my $mybytes;
open(CHIPP, "$ARGV[0]") or die "\nFile Error\n";
open(OUT, ">$ARGV[0].out");
seek(CHIPP,0,0);
while(read(CHIPP, $mybytes, 100)) {
	print OUT $mybytes;
}
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl v5.6.1:

Summary of my perl5 (revision 5 version 6 subversion 1) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cl', ccflags ='-nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX',
    optimize='-O1 -MD -DNDEBUG',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='', ldflags ='-nologo -nodefaultlib -release  -libpath:"D:\perl\lib\CORE"  -machine:x86'
    libpth="D:\perl\lib\CORE"
    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 wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.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 wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release  -libpath:"D:\perl\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY

---
@INC for perl v5.6.1:
    D:/perl/lib
    D:/perl/site/lib
    .

---
Environment for perl v5.6.1:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=D:\PERL\BIN;D:\PERL\5.00502\BIN\MSWIN32-X86-OBJECT;D:\PERL\5.00502\BIN;C:\WINDOWS\SYSTEM\WBEM;C:\WINDOWS;C:\WINDOWS;C:\WINDOWS\COMMAND;C:\VIM\VIM58
    PERL_BADLANG (unset)
    SHELL (unset)





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