Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tk broken by regexp fail #973

Closed
p5pRT opened this issue Dec 18, 1999 · 4 comments
Closed

Tk broken by regexp fail #973

p5pRT opened this issue Dec 18, 1999 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 18, 1999

Migrated from rt.perl.org#1920 (status was 'resolved')

Searchable as RT1920$

@p5pRT
Copy link
Author

p5pRT commented Dec 18, 1999

From nick@ni-s.u-net.com

This is failing on just-built 5.005_63
 
  my $name = 'pTk';

  print "\$0 is '$0'\n";

  $name = $1 if (($0 =~ m/(?​:^|[\/\\])([\w-]+)(?​:\.\w+)?$/) && ($1 ne '-e'));

  print "'$1'\n";

It prints
1..7
$0 is 't/widget.t'
''
...
ok 1
name is 'pTk'
not ok 2

Note that this is with multiplicity _ON_

Perl Info


Site configuration information for perl 5.00563:

Configured by nick at Sat Dec 18 09:33:56 GMT 1999.

Summary of my perl5 (revision 5.0 version 5 subversion 63) configuration:
  Platform:
    osname=linux, osvers=2.2.5, archname=i686-linux-multi
    uname='linux bactrian 2.2.5 #56 sat oct 9 20:14:35 bst 1999 i686 unknown '
    config_args='-der -O -Dcc=gcc -Doptimize=-O2 -g -Dusemymalloc=n -Dusemultiplicity=y -Dusevfork=false'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
    use64bits=undef usemultiplicity=define
  Compiler:
    cc='gcc', optimize='-O2 -g', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
    cppflags='-Dbool=char -DHAS_BOOL -DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    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
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=, 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 5.00563:
    /usr/local/lib/perl5.00563/i686-linux
    /usr/local/lib/perl5.00563/share
    /usr/local/lib/perl5.00563/site/i686-linux
    /usr/local/lib/site_perl
    .


Environment for perl 5.00563:
    HOME=/home/nick
    LANG=en_GB.ISO-8859-1
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/nick/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/openwin/bin:/usr/games/bin:/usr/games:/opt/gnome/bin:/opt/kde/bin:.
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Dec 18, 1999

From [Unknown Contact. See original ticket]

Nick Ing-Simmons writes​:

This is failing on just-built 5.005_63

my $name = 'pTk';

print "\\$0 is '$0'\\n";

$name = $1 if \(\($0 =~ m/\(?​:^|\[\\/\\\\\]\)\(\[\\w\-\]\+\)\(?​:\\\.\\w\+\)?$/\) && \($1 ne '\-e'\)\);

print "'$1'\\n";

This is not fixed by the patch I sent out recently. Here is the
simplified case​:

./perl -e '"ab" =~ /(^|a)b/ or die'

Compiling REx `(^|a)b'
size 12 first at 3
synthetic stclass.
  1​: OPEN1(3)
  3​: BRANCH(5)
  4​: BOL(8)
  5​: BRANCH(8)
  6​: EXACT <a>(8)
  8​: CLOSE1(10)
  10​: EXACT <b>(12)
  12​: END(0)
floating `b' at 0..1 (checking floating) stclass `ANYOF[b]' minlen 1

Note that stclass is [b], not [ab] as it should have been.

Ilya

@p5pRT
Copy link
Author

p5pRT commented Dec 19, 1999

From [Unknown Contact. See original ticket]

Ilya Zakharevich <ilya@​math.ohio-state.edu> writes​:

Nick Ing-Simmons writes​:

This is failing on just-built 5.005_63

my $name = 'pTk';

print "\\$0 is '$0'\\n";

$name = $1 if \(\($0 =~ m/\(?&#8203;:^|\[\\/\\\\\]\)\(\[\\w\-\]\+\)\(?&#8203;:\\\.\\w\+\)?$/\) && \($1 ne '\-e'\)\);

print "'$1'\\n";

This is not fixed by the patch I sent out recently.

So I discovered having applied the patch full of hope :-(

Here is the
simplified case​:

./perl -e '"ab" =~ /(^|a)b/ or die'

Compiling REx `(^|a)b'
size 12 first at 3
synthetic stclass.
1​: OPEN1(3)
3​: BRANCH(5)
4​: BOL(8)
5​: BRANCH(8)
6​: EXACT <a>(8)
8​: CLOSE1(10)
10​: EXACT <b>(12)
12​: END(0)
floating `b' at 0..1 (checking floating) stclass `ANYOF[b]' minlen 1

Note that stclass is [b], not [ab] as it should have been.

Ilya
--
Nick Ing-Simmons

@p5pRT
Copy link
Author

p5pRT commented Dec 24, 1999

From [Unknown Contact. See original ticket]

Nick Ing-Simmons writes​:

This is failing on just-built 5.005_63

my $name = 'pTk';

print "\\$0 is '$0'\\n";

$name = $1 if \(\($0 =~ m/\(?&#8203;:^|\[\\/\\\\\]\)\(\[\\w\-\]\+\)\(?&#8203;:\\\.\\w\+\)?$/\) && \($1 ne '\-e'\)\);

This should help​:

Inline Patch
--- ./t/op/re_tests-pre	Fri Dec 24 15:24:05 1999
+++ ./t/op/re_tests	Tue Dec 21 19:36:10 1999
@@ -749,3 +749,4 @@ tt+$	xxxtt	y	-	-
 '(\.c(pp|xx|c)?$)'i	IO.c	y	$1	.c
 ^([a-z]:)	C:/	n	-	-
 '^\S\s+aa$'m	\nx aa	y	-	-
+(^|a)b	ab	y	-	-
--- ./regcomp.c-pre	Fri Dec 24 15:23:30 1999
+++ ./regcomp.c	Fri Dec 24 15:42:14 1999
@@ -545,9 +545,21 @@ S_study_chunk(pTHX_ regnode **scanp, I32
 		    }
 		}
 		else if (flags & SCF_DO_STCLASS_AND) {
-		    cl_and(data->start_class, &accum);
-		    if (min1)
+		    if (min1) {
+			cl_and(data->start_class, &accum);
 			flags &= ~SCF_DO_STCLASS;
+		    }
+		    else {
+			/* Switch to OR mode: cache the old value of 
+			 * data->start_class */
+			StructCopy(data->start_class, &and_with,
+				   struct regnode_charclass_class);
+			flags &= ~SCF_DO_STCLASS_AND;
+			StructCopy(&accum, data->start_class,
+				   struct regnode_charclass_class);
+			flags |= SCF_DO_STCLASS_OR;
+			data->start_class->flags |= ANYOF_EOS;
+		    }
 		}
 	    }
 	    else if (code == BRANCHJ)	/* single branch is optimized. */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant