develooper Front page | perl.perl5.porters | Postings from June 2013

[perl #118499] ${^MATCH} undefined in "abcde" =~ s/b../(${^MATCH})/pr

Thread Previous | Thread Next
From:
Zsban Ambrus
Date:
June 16, 2013 09:18
Subject:
[perl #118499] ${^MATCH} undefined in "abcde" =~ s/b../(${^MATCH})/pr
Message ID:
rt-3.6.HEAD-2552-1371374266-277.118499-75-0@perl.org
# New Ticket Created by  Zsban Ambrus 
# Please include the string:  [perl #118499]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118499 >


This is a bug report for perl from ambrus@math.bme.hu,
generated with the help of perlbug 1.39 running under perl 5.16.3.


-----------------------------------------------------------------
[Please describe your issue here]


$ perl -wE 'say "abcde" =~ s/b../(${^MATCH})/pr;'
Use of uninitialized value $^MATCH in concatenation (.) or string at -e line 1.
a()e
$ perl -wE 'say "abcde" =~ s/b..(?{})/(${^MATCH})/pr;'
a(bcd)e
$

I believe the output of the first command is incorrect, it should print the
same as the second statement.  The /p flag on the regex asks the regex
engine to fill ${^MATCH}, and this should be available in the right hand
side of the substitution.

This bug occurs to me in perl 5.16.3, as shown below.  Mauke claims that it
does not occur in perl 5.18.0, which I haven't verified.  Kudos to rayman on
perlmonks for pointing out this bug.

Ambrus


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.16.3:

Configured by ambrus at Sun May 12 14:36:09 CEST 2013.

Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

  Platform:
    osname=linux, osvers=2.6.37, archname=x86_64-linux
    uname='linux king 2.6.37 #6 smp sun mar 13 20:15:05 cet 2011
x86_64 gnulinux '
    config_args='-der'
    hint=previous, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    ccversion='', gccversion='4.7.1', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    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 -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib
/lib64 /usr/lib64 /usr/local/lib64
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.11.3.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.11.3'
  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'

Locally applied patches:


---
@INC for perl 5.16.3:
    /usr/local/perl5.16/lib/perl5/site_perl/5.16.3/x86_64-linux
    /usr/local/perl5.16/lib/perl5/site_perl/5.16.3
    /usr/local/perl5.16/lib/perl5/5.16.3/x86_64-linux
    /usr/local/perl5.16/lib/perl5/5.16.3
    /usr/local/perl5.16/lib/perl5/site_perl/5.16.1
    /usr/local/perl5.16/lib/perl5/site_perl/5.16.1/x86_64-linux
    /usr/local/perl5.16/lib/perl5/site_perl
    .

---
Environment for perl 5.16.3:
    HOME=/home/ambrus
    LANG (unset)
    LANGUAGE (unset)
    LC_CTYPE=hu_HU
    LD_LIBRARY_PATH=/home/ambrus/local/lib/
    LOGDIR (unset)
    PATH=/home/ambrus/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/bash


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About