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

regex: /(?(?!))/ incorrectly fails the match #14947

Closed
p5pRT opened this issue Sep 30, 2015 · 4 comments
Closed

regex: /(?(?!))/ incorrectly fails the match #14947

p5pRT opened this issue Sep 30, 2015 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 30, 2015

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

Searchable as RT126222$

@p5pRT
Copy link
Author

p5pRT commented Sep 30, 2015

From victor@drawall.cc

Created by @Grimy

In a regex conditional expression (?(condition)yes-pattern|no-pattern), if the
condition is (?!), it fails the match outright instead of matching no-pattern.

This may be linked to the optimization documented later in perlre​: “(?!) gets
optimised into (*FAIL) internally”. Doing this replacement when (?!) is the
condition of a conditional expression is invalid.

How to reproduce
----------------

perl5.23.4 -e 'print /(?(?!)(?{print "Yes"})|(?{print "No"}))/'

Expected behavior
-----------------

No1

Actual behavior
---------------

Perl prints nothing, indicating that​:
1) Neither the yes-pattern nor the no-pattern were attempted;
2) The match failed, when it should have suceeded.

Affected versions
-----------------

Current blead (94757bf) is affected.
perl5.20.2 is affected.

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl 5.23.4:

Configured by grimy at Wed Sep 30 09:47:59 CEST 2015.

Summary of my perl5 (revision 5 version 23 subversion 4) configuration:
  Commit id: 94757bf7ac8451b3588578f287f9c511a04011bf
  Platform:
    osname=linux, osvers=4.1.3-201.fc22.x86_64, archname=x86_64-linux
    uname='linux amaranth 4.1.3-201.fc22.x86_64 #1 smp wed jul 29
19:50:22 utc 2015 x86_64 x86_64 x86_64 gnulinux '
    config_args='-ds -e -Dusedevel'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fwrapv -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='5.1.1 20150618 (Red Hat 5.1.1-4)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8,
byteorder=12345678, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64
/lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.21.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.21'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib
-fstack-protector-strong'



@INC for perl 5.23.4:
    /usr/local/lib/perl5/site_perl/5.23.4/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.23.4
    /usr/local/lib/perl5/5.23.4/x86_64-linux
    /usr/local/lib/perl5/5.23.4
    .


Environment for perl 5.23.4:
    HOME=/home/grimy
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/lib64:/home/grimy/repos/SDK/InstallationCentOS59/IGC/Bin:/home/grimy/repos/SDK/Produits/QT-FC5/lib
    LOGDIR (unset)
    PATH=/home/grimy/bin:/home/grimy/.nvim/scripts:/home/grimy/.autojump/bin:/usr/java/jdk1.8.0_31/bin:/home/grimy/repos/CoreTex/bin:/home/grimy/bin:/home/grimy/.nvim/scripts:/home/grimy/.autojump/bin:/usr/java/jdk1.8.0_31/bin:/home/grimy/repos/CoreTex/bin:/usr/local/bin:/bin:/usr/bin:/home/grimy/repos/SDK/InstallationCentOS59/IGC/Bin:/home/grimy/bin:/home/grimy/.gem/ruby/2.0.0/bin:/sbin:/home/grimy/repos/SDK/InstallationCentOS59/IGC/Bin:/home/grimy/bin:/home/grimy/.gem/ruby/2.0.0/bin:/sbin
    PERL_BADLANG (unset)
    SHELL=/usr/bin/fish

@p5pRT
Copy link
Author

p5pRT commented Oct 4, 2015

From @demerphq

Thanks, fixed in 6625d92

@p5pRT
Copy link
Author

p5pRT commented Oct 4, 2015

The RT System itself - Status changed from 'new' to 'open'

@p5pRT p5pRT closed this as completed Oct 4, 2015
@p5pRT
Copy link
Author

p5pRT commented Oct 4, 2015

@demerphq - Status changed from 'open' to 'resolved'

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