Front page | perl.perl5.porters |
Postings from September 2013
[perl #119793] /x on \Q#foo\E doesn't match '#foo', # becomes special
Thread Next
From:
bulk88
Date:
September 15, 2013 07:44
Subject:
[perl #119793] /x on \Q#foo\E doesn't match '#foo', # becomes special
Message ID:
rt-3.6.HEAD-1873-1379231058-760.119793-75-0@perl.org
# New Ticket Created by bulk88
# Please include the string: [perl #119793]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119793 >
This is a bug report for perl from bulk88@hotmail.com,
generated with the help of perlbug 1.39 running under perl 5.19.4.
-----------------------------------------------------------------
[Please describe your issue here]
Following perlre, I used \Q\E to escape things from /x.
The \Q\E line in perlre was added in June 2006 in
http://perl5.git.perl.org/perl.git/commitdiff/1031e5dba2bc40203b5942f84d3d2bc335470dba .
_______________________________________________
$_ = '# These definitions are from config.sh (via C:\p519\src\lib/Config.pm).';
if(/\Q# These definitions are from config.sh (via \E/x) {print 1;}
else {print 0;}
______________________________________________
With /x modifier, it prints 0, without prints 1. The bug is the "#" is still special after \Q\E, but only under /x, and doesn't become a normal dead character. This contradicts the perlre suggestion. It also contradicts that \Q\E are supposed to be the same as quotemeta() according to jamesw on irc. This line from perlfunc supports that in bulk88's opinion http://perl5.git.perl.org/perl.git/blob/HEAD:/pod/perlfunc.pod#l5334 .
______________________________________________
$_ = '# These definitions are from config.sh (via C:\p519\src\lib/Config.pm).';
my $x = quotemeta;
print /$x/x;
______________________________________________
prints 1.
I don't know what the correct behavior here, and if there is a doc problem here or a regexp bug or what but something has to change. Tested with Perl 5.12.3 and Perl 5.19.4.
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl 5.19.4:
Configured by Administrator at Thu Sep 5 21:44:53 2013.
Summary of my perl5 (revision 5 version 19 subversion 4) configuration:
Derived from:
Platform:
osname=MSWin32, osvers=5.2, archname=MSWin32-x64-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cl', ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -fp:precise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO',
optimize='-O1 -MD -Zi -DNDEBUG -GL -fp:precise',
cppflags='-DWIN32'
ccversion='15.00.30729.01', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='__int64', ivsize=8, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\p519\lib\CORE" -machine:AMD64 "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"'
libpth=\lib
libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl519.lib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\p519\lib\CORE" -machine:AMD64 "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"'
Locally applied patches:
uncommitted-changes
---
@INC for perl 5.19.4:
C:/p519/site/lib
C:/p519/lib
.
---
Environment for perl 5.19.4:
CYGWIN=tty
HOME (unset)
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH=/usr/lib/x86:/usr/X11R6/lib
LOGDIR (unset)
PATH=C:\p519\bin;C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\ia32\tbb\vc9;C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\intel64\tbb\vc9;C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\intel64\ipp;C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\ia32\ipp;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32\compiler;C:\Perl\site\bin;C:\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC;C:\Program Files\TortoiseGit\bin
PERL_BADLANG (unset)
SHELL (unset)
Thread Next
-
[perl #119793] /x on \Q#foo\E doesn't match '#foo', # becomes special
by bulk88