Skip Menu |
Report information
Id: 1762
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: jhi [at] cc.hut.fi
Cc:
AdminCc:

Operating System: Solaris
PatchStatus: (no value)
Severity: medium
Type: library
Perl Version: (no value)
Fixed In: (no value)



From: Jarkko Hietaniemi <jhi [...] cc.hut.fi>
Date: Wed, 10 Nov 1999 14:55:15 +0200 (EET)
To: perlbug [...] perl.com
Subject: minimal matching discrepancy found by pcre author
Download (untitled) / with headers
text/plain 2.5k
----------------------------------------------------------------- [Please enter your report here] The author of the PCRE (Perl-Compatible Regular Expressions) (ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/), Philip Hazel, has noticed the following oddity in Perl (back in 5.005_02, but it still seems to be present). Surely the below examples should work similarly (the second one should print "bb")? ./perl -wle '"aba" =~ /^(a(b)?)+$/;print $2' b ./perl -wle '"aabbaa" =~ /^(aa(bb)?)+$/;print $2' Use of uninitialized value at -e line 1. [Please do not change anything below this line] ----------------------------------------------------------------- --- Site configuration information for perl 5.00562: Configured by jhi at Wed Nov 10 01:04:17 EET 1999. Summary of my perl5 (revision 5.0 version 5 subversion 62) configuration: Platform: osname=solaris, osvers=2.7, archname=sun4-solaris uname='sunos mimosa.hut.fi 5.7 generic_106541-05 sun4u sparc ' config_args='-ders -Dcc=gcc' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef use64bits=undef usemultiplicity=undef Compiler: cc='gcc', optimize='-O', gccversion=2.8.1 cppflags='-DUSE_LARGE_FILES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccflags ='-DUSE_LARGE_FILES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='gcc', ldflags =' ' libpth=/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec libc=, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-fPIC', lddlflags='-G' Locally applied patches: --- @INC for perl 5.00562: lib /u/vieraat/vieraat/jhi/Perl/lib /opt/lib/perl5/5.00562/sun4-solaris /opt/lib/perl5/5.00562 /opt/lib/site_perl/5.00562/sun4-solaris /opt/lib/site_perl . --- Environment for perl 5.00562: HOME=/u/vieraat/vieraat/jhi LANG=C LANGUAGE (unset) LC_CTYPE=iso_8859_1 LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/u/vieraat/vieraat/jhi/.s:/p/bin:/p/adm/bin:/usr/bin:/usr/sbin:/sbin:/bin:/usr/ccs/bin:/usr/lib:/etc:/lib:/p/X6/bin:/usr/bin/X11:/usr/lib/acct:/usr/5bin:/u/vieraat/vieraat/jhi PERLLIB=/u/vieraat/vieraat/jhi/Perl/lib PERL_BADLANG (unset) SHELL=/bin/zsh
To: jhi [...] cc.hut.fi
Cc: perl5-porters [...] perl.org
Subject: Re: [ID 19991110.002] minimal matching discrepancy found by pcre author
Date: Wed, 10 Nov 1999 08:58:19 -0600
From: Greg Bacon <gbacon [...] itsc.uah.edu>
Download (untitled) / with headers
text/plain 963b
In message <199911101255.OAA16865@mimosa.hut.fi>, Jarkko Hietaniemi writes: : ./perl -wle '"aabbaa" =~ /^(aa(bb)?)+$/;print $2' : Use of uninitialized value at -e line 1. That's because there's no bb at the end: #! /usr/bin/perl -w use strict; print q{"aabbaa" =~ /^(aa(bb)?)+$/}, ":\n"; if ("aabbaa" =~ /^(aa(bb)?)+$/) { print "\$1 = `", defined $1 ? $1 : "<undef>", "'\n", "\$2 = `", defined $2 ? $2 : "<undef>", "'\n"; } else { print "No match.\n"; } print q{"aabbcc" =~ /^((?:aa|cc)(bb)?)+$/}, ":\n"; if ("aabbcc" =~ /^((?:aa|cc)(bb)?)+$/) { print "\$1 = `", defined $1 ? $1 : "<undef>", "'\n", "\$2 = `", defined $2 ? $2 : "<undef>", "'\n"; } else { print "No match.\n"; } [8:57] ruby% ./try "aabbaa" =~ /^(aa(bb)?)+$/: $1 = `aa' $2 = `<undef>' "aabbcc" =~ /^((?:aa|cc)(bb)?)+$/: $1 = `cc' $2 = `<undef>' Greg
From: "Konovalov, Vadim" <vkonovalov [...] lucent.com>
To: jhi [...] cc.hut.fi, perl5-porters [...] perl.org
Subject: RE: [ID 19991110.002] minimal matching discrepancy found by pcre author
Date: Wed, 10 Nov 1999 17:57:45 +0300
Download (untitled) / with headers
text/plain 543b
Show quoted text
> The author of the PCRE (Perl-Compatible Regular Expressions) > (ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/), Philip Hazel, > has noticed the following oddity in Perl (back in 5.005_02, but it > still seems to be present). Surely the below examples should work > similarly (the second one should print "bb")? > > ./perl -wle '"aba" =~ /^(a(b)?)+$/;print $2' > b > > ./perl -wle '"aabbaa" =~ /^(aa(bb)?)+$/;print $2' > Use of uninitialized value at -e line 1. >
But not in 5.004_02, it prints bb in that case! Good luck, Vadim
From: Ilya Zakharevich <ilya [...] math.ohio-state.edu>
Subject: Re: [ID 19991110.002] minimal matching discrepancy found by pcre author
To: jhi [...] cc.hut.fi
Date: Wed, 10 Nov 1999 18:25:03 -0500 (EST)
Cc: perl5-porters [...] perl.org
Jarkko Hietaniemi writes: Show quoted text
> The author of the PCRE (Perl-Compatible Regular Expressions) > (ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/), Philip Hazel, > has noticed the following oddity in Perl (back in 5.005_02, but it > still seems to be present).
All his remarks are correct and I more or less tracked them down to the level of a handlful of C statements. *Fixing* them is a different topic: I might introduce one-shot fixups which will fix any one of them, but it is the general architecture of REx engine which needs to be fixed. Say, I have no idea why REx engine works clean in so many cases. I know no reason why multiple backtracking hacks there in C code lead to more or less "intuitive" behaviour. It looks like any bug report was leading to a fix or two, and the total collection of these special cases more or less keeps water, but not more. I have in mind several bulletproof implemenations of backtracking, but they should be significantly slower than current hacks. I'm still thinking about this. Hope this helps, Ilya


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org