Skip Menu |
Report information
Id: 126222
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: perl5

Owner: demerphq <demerphq [at] gmail.com>
Requestors: victor [at] drawall.cc
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: low
Type: core
Perl Version: 5.23.4
Fixed In: (no value)



From: Victor ADAM <victor [...] drawall.cc>
To: perlbug <perlbug [...] perl.org>
Subject: regex: /(?(?!))/ incorrectly fails the match
Date: Wed, 30 Sep 2015 09:56:00 +0200
This is a bug report for perl from victor.adam@derpymail.org, generated with the help of perlbug 1.40 running under perl 5.23.4. ----------------------------------------------------------------- [Please describe your issue here] 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 ---------------- Show quoted text
> perl5.23.4 -e 'print /(?(?!)(?{print "Yes"})|(?{print "No"}))/'
Expected behavior ----------------- Show quoted text
> 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 (94757bf7ac8451b3588578f287f9c511a04011bf) is affected. perl5.20.2 is affected. [Please do not change anything below this line] ----------------------------------------------------------------- --- 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
RT-Send-CC: perl5-porters [...] perl.org
Thanks, fixed in 6625d92602279361acd0c6185b78c6d201fd81e0


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