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

[ID 20010221.007] +< and +> without seek corrupts file

Thread Next
From:
david_a
Date:
February 21, 2001 16:03
Subject:
[ID 20010221.007] +< and +> without seek corrupts file
Message ID:
200102220003.f1M03Dg19024@garcia.efn.org

This is a bug report for perl from david_a@efn.org,
generated with the help of perlbug 1.13 running under perl 5.00503.

open file with +<.  read some data.  seek position for print.  print to
file okay.  however: if seek not used, then the print will append the data
you read before appending what you really want to print.

open file with +>.  truncates file to 0 so reads don't work.  okay, that's
fine, but then print to file.  then read what you just printed.  you MUST
use seek before printing (which is silly since you can only seek to the
beginning since the file was truncated anyway) or the following will
happen when you print: the data will print fine but will be followed by
data from your SCRIPT ITSELF, beginning with the 5th byte and continuing
for X bytes, where X is the number of bytes you read AFTER the print
command.  is this weird or what?  seems as if the perl parser is very
confused.

these bugs are in 5.003.  when i test with 5.005, the +> bug may have been
corrected, but the +< definitely still exists in 5.005.

david

Site configuration information for perl 5.003:

Configured by aschenck at Sat Aug 24 02:11:41 PDT 1996.

Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
  Platform:
    osname=sunos, osver=4.1.4, archname=sun4-sunos
    uname='sunos garcia 4.1.4 5 sun4m '
    hint=recommended, useposix=true, d_sigaction=define
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.7.2
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=true
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, randbits=31
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ucblib
    libs=-lnsl -ldbm -ldb -ldl -lm -lc -lposix
    libc=/lib/libc.so.1.9.2, so=so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-assert nodefinitions -L/usr/local/lib'


Site configuration information for perl 5.00503:

Configured by jdd at Sat Jul  3 17:08:04 PDT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=sunos, osvers=4.1.4, archname=sun4-sunos
    uname='sunos garcia 4.1.4 21 sun4m '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize=' ', gccversion=2.7.2
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=true
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ucblib
    libs=-lnsl -ldbm -ldl -lm -lc -lposix
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-assert nodefinitions -L/usr/local/lib'



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