List Info

Thread: regexp inconsistency




regexp inconsistency
user name
2007-10-23 10:52:26
# New Ticket Created by  dyuretku.edu.tr 
# Please include the string:  [perl #46747]
# in the subject line of all future correspondence about
this issue. 
# <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=46747 >



This is a bug report for perl from dyuretku.edu.tr,
generated with the help of perlbug 1.34 running under perl
v5.8.3.


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

pL does not behave as it should in some regular
expressions.
Example program:

#!/usr/bin/perl -w
my $foo = 'H';
my $bar = ($foo =~ /^(w.)*w$/);
my $baz = ($foo =~ /^(pL.)*pL$/);
print "[$bar] [$baz]n";

Example output:
[1] []

You would expect to get the same result in both cases.

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

Configured by bhcompile at Thu Apr 15 13:08:28 EDT 2004.

Summary of my perl5 (revision 5.0 version 8 subversion 3)
configuration:
  Platform:
    osname=linux, osvers=2.4.21-4.elsmp,
archname=i386-linux-thread-multi
    uname='linux tweety.devel.redhat.com 2.4.21-4.elsmp #1
smp fri oct 3 17:52:56 edt 2003 i686 i686 i386 gnulinux '
    config_args='-des -Doptimize=-O2 -g -pipe -march=i386
-mcpu=i686 -Dversion=5.8.3 -Dmyhostname=localhost
-Dperladmin=rootlocalhost -Dcc=gcc -Dcf_by=Red Hat, Inc.
-Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux
-Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib
-Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid
-Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow
-Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl
-Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr
-Dinc_version_list=5.8.2 5.8.1 5.8.0'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=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 ='-D_REENTRANT -D_GNU_SOURCE
-DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing
-I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O2 -g -pipe -march=i386 -mcpu=i686',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-DDEBUGGING -fno-strict-aliasing -I/usr/local/include
-I/usr/include/gdbm'
    ccversion='', gccversion='3.3.3 20040412 (Red Hat Linux
3.3.3-7)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8,
byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread
-lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.3.3.so, so=so, useshrplib=true,
libperl=libperl.so
    gnulibc_version='2.3.3'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-rdynamic
-Wl,-rpath,/usr/lib/perl5/5.8.3/i386-linux-thread-multi/CORE
'
    cccdlflags='-fPIC', lddlflags='-shared
-L/usr/local/lib'

Locally applied patches:
    

---
INC
for perl v5.8.3:
    /home/dyuret/lib/perl5/5.8.3/i386-linux-thread-multi
    /home/dyuret/lib/perl5/5.8.3
    /home/dyuret/lib/perl5/i386-linux-thread-multi
    /home/dyuret/lib/perl5/5.8.2
    /home/dyuret/lib/perl5/5.8.1
    /home/dyuret/lib/perl5/5.8.0
    /home/dyuret/lib/perl5
    /usr/lib/perl5/5.8.3/i386-linux-thread-multi
    /usr/lib/perl5/5.8.3
    /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.3
    /usr/lib/perl5/site_perl/5.8.2
    /usr/lib/perl5/site_perl/5.8.1
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl
   
/usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi
   
/usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi
   
/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
   
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.3
    /usr/lib/perl5/vendor_perl/5.8.2
    /usr/lib/perl5/vendor_perl/5.8.1
    /usr/lib/perl5/vendor_perl/5.8.0
    /usr/lib/perl5/vendor_perl
    .

---
Environment for perl v5.8.3:
    HOME=/home/dyuret
    LANG=C
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/home/dyuret/lib:
    LOGDIR (unset)
   
PATH=.:/home/dyuret/bin:/usr/kerberos/bin:/usr/local/bin:/bi
n:/usr/bin:/usr/X11R6/bin:/usr/java/jdk1.5.0_06/bin
    PERL5LIB=:/home/dyuret/lib/perl5
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Re: regexp inconsistency
user name
2007-10-24 04:03:45
On Tue, Oct 23, 2007 at 08:52:26AM -0700, dyuret  ku. edu.
tr wrote:
> # New Ticket Created by  dyuretku.edu.tr 
> # Please include the string:  [perl #46747]
> # in the subject line of all future correspondence
about this issue. 
> # <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=46747 >
> 
> 
> 
> This is a bug report for perl from dyuretku.edu.tr,
> generated with the help of perlbug 1.34 running under
perl v5.8.3.
> 
> 
>
------------------------------------------------------------
-----
> [Please enter your report here]
> 
> pL does not behave as it should in some regular
expressions.
> Example program:
> 
> #!/usr/bin/perl -w
> my $foo = 'H';
> my $bar = ($foo =~ /^(w.)*w$/);
> my $baz = ($foo =~ /^(pL.)*pL$/);
> print "[$bar] [$baz]n";
> 
> Example output:
> [1] []
> 
> You would expect to get the same result in both cases.


The optimizer seems to be the cause of this:

  $ perl -Mre=debug -e '"H" =~ /^(pL.)*pL$/'
  [ .. ]
  Guessing start of match in sv for REx
"^(pL.)*pL$" against "H"
  Found floating substr ""$ at offset 1...
  start_shift: 1 check_at: 1 s: 0 endpos: 1
  Could not match STCLASS...
  Match rejected by optimizer


both "H" =~ /^(pL.)*pL/ and "H" =~
/^pL$/ do match.


Abigail
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )