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

5.005_63: Regex strangeness #949

Closed
p5pRT opened this issue Dec 15, 1999 · 3 comments
Closed

5.005_63: Regex strangeness #949

p5pRT opened this issue Dec 15, 1999 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 15, 1999

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

Searchable as RT1894$

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 1999

From @sciurius

The second match should succeed as well.

$x = "\nx\taa\n";
print "This one matches\n" if $x =~ /^\S\saa$/m;
print "But this one doesn't\n" if $x =~ /^\S\s+aa$/m;

Perl Info


Site configuration information for perl 5.00563:

Configured by jv at Mon Dec 13 17:32:43 MET 1999.

Summary of my perl5 (revision 5.0 version 5 subversion 63) configuration:
  Platform:
    osname=linux, osvers=2.2.13, archname=i386-linux
    uname='linux phoenix.squirrel.nl 2.2.13 #1 fri oct 22 12:28:44 mest 1999 i686 unknown '
    config_args='-des -Dprefix=/usr -Dinstallprefix=/usr -Darchname=i386-linux -Dd_dosuid'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
    use64bits=undef usemultiplicity=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.8.1
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -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='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.0.7.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 5.00563:
    /usr/lib/perl5/5.00563/i386-linux
    /usr/lib/perl5/5.00563
    /usr/lib/site_perl/5.00563/i386-linux
    /usr/lib/site_perl
    .


Environment for perl 5.00563:
    HOME=/home/jv
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=.:/home/jv/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11/bin
    PERL_BADLANG (unset)
    SHELL=/bin/tcsh

@p5pRT
Copy link
Author

p5pRT commented Dec 17, 1999

From [Unknown Contact. See original ticket]

Johan Vromans writes​:

The second match should succeed as well.

$x = "\nx\taa\n";
print "This one matches\n" if $x =~ /^\S\saa$/m;
print "But this one doesn't\n" if $x =~ /^\S\s+aa$/m;

[I did not look into alleged UTEST failures yet...]

Enjoy,
Ilya

Inline Patch
--- ./regexec.c~	Wed Dec  8 15:17:53 1999
+++ ./regexec.c	Fri Dec 17 03:08:26 1999
@@ -730,13 +730,17 @@ Perl_re_intuit_start(pTHX_ regexp *prog,
 			  (long)(other_last - i_strpos)) );
 		goto do_other_anchored;
 	    }
-	    if (!prog->float_substr) {	/* Could have been deleted */
-		if (ml_anch) {
-		    s = t = t + 1;
-		    goto try_at_offset;
-		}
-		goto fail;
+	    /* Another way we could have checked stclass at the
+               current position only: */
+	    if (ml_anch) {
+		s = t = t + 1;
+		DEBUG_r( PerlIO_printf(Perl_debug_log,
+			  "Trying /^/m starting at offset %ld...\n",
+			  (long)(t - i_strpos)) );
+		goto try_at_offset;
 	    }
+	    if (!prog->float_substr)	/* Could have been deleted */
+		goto fail;
 	    /* Check is floating subtring. */
 	  retry_floating_check:
 	    t = check_at - start_shift;
--- ./t/op/re_tests~	Wed Dec  8 15:17:53 1999
+++ ./t/op/re_tests	Wed Dec 15 17:57:32 1999
@@ -748,3 +748,4 @@ tt+$	xxxtt	y	-	-
 '\.c(pp|xx|c)?$'i	IO.c	y	-	-
 '(\.c(pp|xx|c)?$)'i	IO.c	y	$1	.c
 ^([a-z]:)	C:/	n	-	-
+'^\S\s+aa$'m	\nx aa	y	-	-

@p5pRT
Copy link
Author

p5pRT commented Dec 17, 1999

From [Unknown Contact. See original ticket]

Johan Vromans writes​:

The second match should succeed as well.

$x = "\nx\taa\n";
print "This one matches\n" if $x =~ /^\S\saa$/m;
print "But this one doesn't\n" if $x =~ /^\S\s+aa$/m;

Oups, forgot to thank you a lot for your investigations.

Sorry,
Ilya

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