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

[ID 20010228.003] resetting of pos() in multiline regexp breaksmatch for empty lines

From:
dj
Date:
February 28, 2001 12:43
Subject:
[ID 20010228.003] resetting of pos() in multiline regexp breaksmatch for empty lines
Message ID:
200102282042.PAA12363@pelf.harvard.edu
This is a bug report for perl from dj@pelf.harvard.edu,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------
[Please enter your report here]

Here's the test code; note the commented out assignment of
pos():

================================================
$h = <<EOD;
line 1

line 2
EOD


while( $h =~ /^(.*)$/mg )
{
#  pos($h) = pos($h);
  print join( ' ', pos($h), length($1), ">$1<"), "\n";
}
================================================

Running this produces:

6 6 >line 1<
7 0 ><
14 6 >line 2<

Uncommenting the pos() assignment, which should change nothing,
causes the match to go into an infinite loop when it hits the
empty line:

6 6 >line 1<
7 0 ><
7 0 ><
7 0 ><
7 0 ><
7 0 ><
7 0 ><
7 0 ><
7 0 ><
[etc....]

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl v5.6.0:

Configured by dj at Wed Jul  5 17:21:58 EDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris-thread
    uname='sunos pelf 5.6 generic_105181-14 sun4u sparc sunw,ultra-5_10 '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=define useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O -native', gccversion=
    cppflags='-D_REENTRANT'
    ccflags ='-D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' '
    libpth=/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lposix4 -lpthread -lc -lcrypt -lsec
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-G'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /home/dj/lib/perl/sun4-solaris-thread
    /home/dj/lib/perl
    /proj/axaf/simul/lib/perl
    /proj/axaf/pkgs/perl-5.6.0/lib/5.6.0/sun4-solaris-thread
    /proj/axaf/pkgs/perl-5.6.0/lib/5.6.0
    /proj/axaf/pkgs/perl-5.6.0/lib/site_perl/5.6.0/sun4-solaris-thread
    /proj/axaf/pkgs/perl-5.6.0/lib/site_perl/5.6.0
    /proj/axaf/pkgs/perl-5.6.0/lib/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/home/dj
    LANG (unset)
    LANGUAGE (unset)
    LC_COLLATE=en_US.ISO8859-1
    LC_CTYPE=en_US.ISO8859-1
    LC_MESSAGES=C
    LC_MONETARY=en_US.ISO8859-1
    LC_NUMERIC=en_US.ISO8859-1
    LC_TIME=en_US.ISO8859-1
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/data/pelf1/dj/root/bin:/data/pelf1/dj/root/bin/sparc-SunOS-5:/data/pelf1/dj/root/bin/sparc-SunOS:/home/dj/mailbin:/data/pelf1/dj/root/lib/perl/bin/sparc-SunOS-5:/proj/axaf/pkgs/gs/sun4u-SunOS-5/bin:/proj/axaf/pkgs/perl-5.6.0/bin/sparc-SunOS-5:/proj/axaf/simul/bin/sun4u-SunOS-5:/proj/axaf/simul/bin/sun4m-SunOS-5:/proj/axaf/pkgs/pgsql/bin/sparc-SunOS-5:/proj/axaf/pkgs/netpbm/sparc-SunOS-5/bin:/proj/axaf/simul/bin/scripts:/proj/axaf/bin/sun4m-SunOS-5/rdb:/proj/axaf/bin/sun4u-SunOS-5/param:/proj/axaf/bin/sun4u-SunOS-5:/proj/axaf/bin/sun4m-SunOS-5:/proj/axaf/bin/scripts:/soft/newtex/bin/sparc-sun-solaris:/opt/SUNWspro_6.1/bin:/usr/ccs/bin:/opt/local/bin:/usr/sbin:/usr/ucb:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/opt/X11R6/bin:/usr/bin/X11:/opt/X11R5/bin:/soft/purify4.5.1/bin:.
    PERLLIB=/home/dj/lib/perl/sun4-solaris-thread:/home/dj/lib/perl:/proj/axaf/simul/lib/perl
    PERL_BADLANG (unset)
    SHELL=/bin/tcsh




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