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

[ID 20010806.025] Regex bug in 5.6.1

Philip Hazel
August 6, 2001 13:11
[ID 20010806.025] Regex bug in 5.6.1
Message ID:
This is related to the previous bug which I failed to explain clearly
enough (so it got rejected). I hope this is absolutely plain. Consider
these two fragments:

$x = "CD";
$x =~ /(AB)*?CD/;
if (defined $1) { print "\"$1\"\n"; } else { print "undefined\n"; }

$x = "CD";
$x =~ /(AB)*CD/;
if (defined $1) { print "\"$1\"\n"; } else { print "undefined\n"; }

The only different in the two cases is the "?" in the first one. In
both cases the group must match zero times; but for the first, $1 is set
to "", whereas in the second case it is undefined. This just has to be
a bug - they ought at least to give the same result.  (And I think it
ought to be undefined.)


This is the "perl -V" output for the Perl I ran this test on:

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
    osname=solaris, osvers=2.8, archname=sun4-solaris
    uname='sunos 5.8 generic sun4u sparc sunw,ultra-1 '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    cc='cc', ccflags ='-I/opt/local/include -I/opt/gnu/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    cppflags='-I/opt/local/include -I/opt/gnu/include'
    ccversion='WorkShop Compilers 5.0 98/12/15 C 5.0', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    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=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/opt/local/lib -L/opt/gnu/lib -L/opt/SUNWspro/SC5.0/lib '
    libpth=/opt/local/lib /opt/gnu/lib /opt/SUNWspro/SC5.0/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldl -lm -lc
    perllibs=-lsocket -lnsl -ldl -lm -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-G -L/opt/local/lib -L/opt/gnu/lib -L/opt/SUNWspro/SC5.0/lib'

Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under solaris
  Compiled at May 15 2001 09:23:25
    . Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About