Front page | perl.perl5.porters |
Postings from July 2000
[ID 20000729.004] (??{ ... }) not sucking data correctly?
From:
Jeffrey Friedl
Date:
July 31, 2000 11:13
Subject:
[ID 20000729.004] (??{ ... }) not sucking data correctly?
Message ID:
200007300544.WAA19158@ventrue.yahoo.com
This is a bug report for perl from jfriedl@yahoo-inc.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.
-----------------------------------------------------------------
[Please enter your report here]
I hesitate to submit this as a bug because it seems that a lot would not be
working if this really is a bug in Perl instead of a bug in my
understanding. If the latter, please accept my appologies for wasting your
time.
This program:
#!/usr/local/bin/perl -w
use strict;
use re 'eval';
$_ = "a(b(c)d)e";
my $regex;
$regex = q{
\(
(?>
(?> [^()]+ )
|
(??{ $regex })
)*
\)
};
print "REGEX IS: $regex\n\n";
m/$regex/x;
print "matched [$&]\n";
when run generates:
REGEX IS:
\(
(?>
(?> [^()]+ )
|
(??{ $regex })
)*
\)
Use of uninitialized value in pattern match (m//) at /tmp/foo3 line 24.
matched [(c)]
I would have expected the matched string would be "(b(c)d)", and that there
would be no uninitialized value (I'd guess that $regex would be the value
that, well, it was when m// first got it.)
When run with re 'debug', it generates:
jfriedl@fummy> perl /tmp/foo3
Compiling REx `
\(
(?:
(?> [^()]+ )
|
(??{ $np })
)*
\)
'
size 29 first at 1
1: EXACT <(>(3)
3: CURLYX {0,32767}(26)
5: BRANCH(20)
6: SUSPEND(25)
8: PLUS(18)
9: ANYOF[\0-'*-\377](0)
18: SUCCEED(0)
19: TAIL(24)
20: BRANCH(24)
21: LOGICAL[2](22)
22: EVAL(25)
24: TAIL(25)
25: WHILEM[1/1](0)
26: NOTHING(27)
27: EXACT <)>(29)
29: END(0)
anchored `(' at 0 floating `)' at 1..2147483647 (checking floating) minlen 2 with eval
REGEX IS:
\(
(?>
(?> [^()]+ )
|
(??{ $regex })
)*
\)
Compiling REx `
\(
(?>
(?> [^()]+ )
|
(??{ $regex })
)*
\)
'
size 32 first at 1
1: EXACT <(>(3)
3: CURLYX {0,32767}(29)
5: SUSPEND(28)
7: BRANCH(22)
8: SUSPEND(26)
10: PLUS(20)
11: ANYOF[\0-'*-\377](0)
20: SUCCEED(0)
21: TAIL(26)
22: BRANCH(26)
23: LOGICAL[2](24)
24: EVAL(26)
26: SUCCEED(0)
27: TAIL(28)
28: WHILEM[1/1](0)
29: NOTHING(30)
30: EXACT <)>(32)
32: END(0)
anchored `(' at 0 floating `)' at 1..2147483647 (checking floating) minlen 2 with eval
Guessing start of match, REx `
\(
(?>
(?> [^()]+ )
|
...' against `a(b(c)d)e'...
Found floating substr `)' at offset 5...
Found anchored substr `(' at offset 1...
Guessed: match at offset 1
Matching REx `
\(
(?>
(?> [^()]+ )
|
...' against `(b(c)d)e'
Setting an EVAL scope, savestack=16
1 <a> <(b(c)d)e> | 1: EXACT <(>
2 <a(> <b(c)d)e> | 3: CURLYX {0,32767}
2 <a(> <b(c)d)e> | 28: WHILEM[1/1]
0 out of 0..32767 cc=bffff0c4
Setting an EVAL scope, savestack=21
2 <a(> <b(c)d)e> | 5: SUSPEND
2 <a(> <b(c)d)e> | 7: BRANCH
Setting an EVAL scope, savestack=21
2 <a(> <b(c)d)e> | 8: SUSPEND
2 <a(> <b(c)d)e> | 10: PLUS
ANYOF[\0-'*-\377] can match 1 times out of 32767...
Setting an EVAL scope, savestack=21
3 <a(b> <(c)d)e> | 20: SUCCEED
could match...
3 <a(b> <(c)d)e> | 26: SUCCEED
could match...
3 <a(b> <(c)d)e> | 28: WHILEM[1/1]
1 out of 0..32767 cc=bffff0c4
Setting an EVAL scope, savestack=26
3 <a(b> <(c)d)e> | 5: SUSPEND
3 <a(b> <(c)d)e> | 7: BRANCH
Setting an EVAL scope, savestack=26
3 <a(b> <(c)d)e> | 8: SUSPEND
3 <a(b> <(c)d)e> | 10: PLUS
ANYOF[\0-'*-\377] can match 0 times out of 32767...
Setting an EVAL scope, savestack=26
failed...
failed...
3 <a(b> <(c)d)e> | 23: LOGICAL[2]
3 <a(b> <(c)d)e> | 24: EVAL
re_eval 0x810c180
Use of uninitialized value in pattern match (m//) at /tmp/foo3 line 25.
Compiling REx `'
size 2 first at 1
1: NOTHING(2)
2: END(0)
minlen 0
Entering embedded `'
Setting an EVAL scope, savestack=31
3 <a(b> <(c)d)e> | 1: NOTHING
3 <a(b> <(c)d)e> | 2: END
Setting an EVAL scope, savestack=36
3 <a(b> <(c)d)e> | 26: SUCCEED
could match...
3 <a(b> <(c)d)e> | 28: WHILEM[1/1]
2 out of 0..32767 cc=bffff0c4
empty match detected, try continuation...
3 <a(b> <(c)d)e> | 29: NOTHING
3 <a(b> <(c)d)e> | 30: EXACT <)>
failed...
failed...
failed, try continuation...
3 <a(b> <(c)d)e> | 29: NOTHING
3 <a(b> <(c)d)e> | 30: EXACT <)>
failed...
failed...
failed, try continuation...
2 <a(> <b(c)d)e> | 29: NOTHING
2 <a(> <b(c)d)e> | 30: EXACT <)>
failed...
failed...
failed...
Setting an EVAL scope, savestack=16
3 <a(b> <(c)d)e> | 1: EXACT <(>
4 <a(b(> <c)d)e> | 3: CURLYX {0,32767}
4 <a(b(> <c)d)e> | 28: WHILEM[1/1]
0 out of 0..32767 cc=bffff0c4
Setting an EVAL scope, savestack=21
4 <a(b(> <c)d)e> | 5: SUSPEND
4 <a(b(> <c)d)e> | 7: BRANCH
Setting an EVAL scope, savestack=21
4 <a(b(> <c)d)e> | 8: SUSPEND
4 <a(b(> <c)d)e> | 10: PLUS
ANYOF[\0-'*-\377] can match 1 times out of 32767...
Setting an EVAL scope, savestack=21
5 <a(b(c> <)d)e> | 20: SUCCEED
could match...
5 <a(b(c> <)d)e> | 26: SUCCEED
could match...
5 <a(b(c> <)d)e> | 28: WHILEM[1/1]
1 out of 0..32767 cc=bffff0c4
Setting an EVAL scope, savestack=26
5 <a(b(c> <)d)e> | 5: SUSPEND
5 <a(b(c> <)d)e> | 7: BRANCH
Setting an EVAL scope, savestack=26
5 <a(b(c> <)d)e> | 8: SUSPEND
5 <a(b(c> <)d)e> | 10: PLUS
ANYOF[\0-'*-\377] can match 0 times out of 32767...
Setting an EVAL scope, savestack=26
failed...
failed...
5 <a(b(c> <)d)e> | 23: LOGICAL[2]
5 <a(b(c> <)d)e> | 24: EVAL
re_eval 0x810c180
Entering embedded `'
Setting an EVAL scope, savestack=31
5 <a(b(c> <)d)e> | 1: NOTHING
5 <a(b(c> <)d)e> | 2: END
Setting an EVAL scope, savestack=36
5 <a(b(c> <)d)e> | 26: SUCCEED
could match...
5 <a(b(c> <)d)e> | 28: WHILEM[1/1]
2 out of 0..32767 cc=bffff0c4
empty match detected, try continuation...
5 <a(b(c> <)d)e> | 29: NOTHING
5 <a(b(c> <)d)e> | 30: EXACT <)>
6 <a(b(c)> <d)e> | 32: END
Match successful!
matched [(c)]
Freeing REx: `
\(
(?>
(?> [^()]+ )
|
...'
Freeing REx: `
\(
(?:
(?> [^()]+ )
|
(??{ $n...'
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=medium
---
Site configuration information for perl v5.6.0:
Configured by jfriedl at Sat Jul 29 20:09:33 PDT 2000.
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
Platform:
osname=linux, osvers=2.2.15, archname=i686-linux
uname='linux fummy.dsl.yahoo.com 2.2.16 #6 smp sun jul 23 11:26:16 pdt 2000 i686 unknown '
config_args='-ds -e -A optimize=-g'
hint=previous, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
Compiler:
cc='cc', optimize='-O2 -g', gccversion=pgcc-2.91.66 19990314 (egcs-1.1.2 release)
cppflags='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
ccflags ='-fno-strict-aliasing -I/usr/local/include -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=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
libc=/lib/libc-2.1.1.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.6.0:
/home/jfriedl/lib/perl
/home/jfriedl/lib/perl/yahoo
/usr/local/lib/perl5/5.6.0/i686-linux
/usr/local/lib/perl5/5.6.0
/usr/local/lib/perl5/site_perl/5.6.0/i686-linux
/usr/local/lib/perl5/site_perl/5.6.0
/usr/local/lib/perl5/site_perl
.
---
Environment for perl v5.6.0:
HOME=/home/jfriedl
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH=/usr/local/pgsql/lib:/home/jfriedl/src/rvplayer5.0
LOGDIR (unset)
PATH=/home/jfriedl/bin:/home/jfriedl/common/bin:/usr/local/gcc-2.95.2/bin:.:/usr/local/pgsql/bin:/usr/local/bin:/usr/X11R6/bin:/bin:/usr/bin:/usr/sbin:/sbin:/home/jfriedl/src/rvplayer5.0
PERLLIB=/home/jfriedl/lib/perl:/home/jfriedl/lib/perl/yahoo
PERL_BADLANG (unset)
SHELL=/bin/tcsh
-
[ID 20000729.004] (??{ ... }) not sucking data correctly?
by Jeffrey Friedl