Hi,
The report generated by perlbug is attached. Thanks.

      
Cc: win32-vanilla@perl.org
Subject: Using tell(DATA) within __DATA__ file buffer is broken on Win32
Message-Id: <5.12.0_1476_1300163...@4391c52r80c5l7.nam.ent.duke-energy.com>
Reply-To: brent.shie...@ieee.org
To: perl...@perl.org


This is a bug report for perl from brent.shie...@ieee.org,
generated with the help of perlbug 1.39 running under perl 5.12.0.


-----------------------------------------------------------------
[Please describe your issue here]

When I use <DATA> to read part of the DATA file and then "tell DATA", the value 
returned by "tell DATA" is off by the number of newlines that
have been read.

This has been discussed at perlmonks and another experienced programmer agreed 
that it is likely a bug. I tested it on Knoppix Linux and it does not happen 
there.
Another user checked it on ActivePerl 5.12.1 with the code below and it 
occurred there also.

Thanks,
Brent Shields



http://www.perlmonks.com/?node_id=892784

#!/usr/bin/perl
use strict;
use warnings;

my @data_positions = tell(DATA);
while (<DATA>){
    if (/^__DATA__$/) {
        push @data_positions, tell(DATA);
    }
}

my @fh_positions;
open(my $fh, '<', $0) or die;
while (<$fh>){
    if (/^__DATA__$/) {
        push @fh_positions, tell($fh);
    }
}

print("@data_positions\n");
print("@fh_positions\n");

__DATA__
ab
__DATA__
ab

__DATA__
ab
__DATA__
lotsa junk
nothing


*****************************************************
Output:
389 401 414 426
389 403 419 433





[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.12.0:

Configured by 1 at Thu May  6 16:22:52 2010.

Summary of my perl5 (revision 5 version 12 subversion 0) configuration:
   
  Platform:
    osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
    uname='Win32 strawberryperl 5.12.0.1 #1 Thu May  6 16:09:27 2010 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.0:
    C:/strawberry/perl/site/lib
    C:/strawberry/perl/vendor/lib
    C:/strawberry/perl/lib
    .

---
Environment for perl 5.12.0:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\WINNT;C:\WINNT\system32;C:\WINNT\System32\Wbem;C:\Program 
Files\Intel\DMIX;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common 
Files\Ulead Systems\MPEG;C:\Program Files\ThinkPad\ConnectUtilities;C:\Program 
Files\Common Files\Lenovo;C:\SQLLIB\BIN;C:\SQLLIB\FUNCTION;C:\Program 
Files\Utimaco\SafeGuard 
Easy\;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Program
 Files\VanDyke Software\SecureFX\;C:\Program 
Files\GnuWin32\bin\;c:\b\;c:\usr\bin\;C:\Eterra\e_terrabrowser\
    PERL_BADLANG (unset)
    SHELL (unset)

Reply via email to