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

s##$_=//#e fails unless $`, $&, or $' are used #12666

Closed
p5pRT opened this issue Dec 22, 2012 · 6 comments
Closed

s##$_=//#e fails unless $`, $&, or $' are used #12666

p5pRT opened this issue Dec 22, 2012 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 22, 2012

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

Searchable as RT116176$

@p5pRT
Copy link
Author

p5pRT commented Dec 22, 2012

From tb@teebee.de

This is a bug report for perl from tb@​teebee.de,
generated with the help of perlbug 1.39 running under perl 5.16.2.


s///e fails if $_ is set inside the replacement section while a
matching m// takes place and $`, $&, or $' are not used. See
the following test cases for details​:

$ perl --version|head -2|tail -1
This is perl 5, version 16, subversion 2 (v5.16.2) built for i686-linux

$ cat case1.pl
print"case 1\n->";
$&;$_="test";s##$_=//#e;print;
print"<-\n";

$ perl case1.pl
case 1
->1test<-

$ cat case2.pl
print"case 2\n->";
$_="test";s##$_=//#e;print;
print"<-\n";

$ perl case2.pl
case 2
->11st<-



Flags​:
  category=core
  severity=low


Site configuration information for perl 5.16.2​:

Configured by buchholz at Sat Dec 15 13​:50​:00 CET 2012.

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

  Platform​:
  osname=linux, osvers=2.6.32-45-generic, archname=i686-linux
  uname='linux sleipnir 2.6.32-45-generic #101-ubuntu smp mon dec 3
15​:41​:13 utc 2012 i686 gnulinux '
  config_args='-de
-Dprefix=/home/buchholz/perl5/perlbrew/perls/perl-5.16.2'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=undef, use64bitall=undef, 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'
  ccversion='', gccversion='4.4.3', gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
  alignbytes=4, 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
/usr/lib/i486-linux-gnu /usr/lib64
  libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
  libc=/lib/libc-2.11.1.so, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.11.1'
  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.2​:
  /home/buchholz/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2/i686-linux
  /home/buchholz/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2
  /home/buchholz/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2/i686-linux
  /home/buchholz/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2
  .


Environment for perl 5.16.2​:
  HOME=/home/buchholz
  LANG=en_US.utf8
  LANGUAGE (unset)
  LD_LIBRARY_PATH=/home/buchholz/my/lib
  LOGDIR (unset)
  PATH=/home/buchholz/perl5/perlbrew/bin​:/home/buchholz/perl5/perlbrew/perls/perl-5.16.2/bin​:/home/buchholz/bin​:/usr/local/sbin​:/usr/local/bin​:/usr/sbin​:/usr/bin​:/sbin​:/bin​:/usr/games
  PERLBREW_MANPATH=/home/buchholz/perl5/perlbrew/perls/perl-5.16.2/man
  PERLBREW_PATH=/home/buchholz/perl5/perlbrew/bin​:/home/buchholz/perl5/perlbrew/perls/perl-5.16.2/bin
  PERLBREW_PERL=perl-5.16.2
  PERLBREW_ROOT=/home/buchholz/perl5/perlbrew
  PERLBREW_SKIP_INIT=1
  PERLBREW_VERSION=0.42
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jan 1, 2017

From @jkeenan

On Sat, 22 Dec 2012 16​:25​:09 GMT, tb@​teebee.de wrote​:

This is a bug report for perl from tb@​teebee.de,
generated with the help of perlbug 1.39 running under perl 5.16.2.

-----------------------------------------------------------------
s///e fails if $_ is set inside the replacement section while a
matching m// takes place and $`, $&amp;, or $' are not used. See
the following test cases for details​:

$ perl --version|head -2|tail -1
This is perl 5, version 16, subversion 2 (v5.16.2) built for i686-
linux

$ cat case1.pl
print"case 1\n->";
$&;$_="test";s##$_=//#e;print;
print"<-\n";

$ perl case1.pl
case 1
->1test<-

$ cat case2.pl
print"case 2\n->";
$_="test";s##$_=//#e;print;
print"<-\n";

$ perl case2.pl
case 2
->11st<-

When I ran your 'case2.pl' on perl-5.20 and later, I got the results you got in your 'case1.pl' -- suggesting that the problem had been fixed along the way.

I rewrote your 'case2.pl' in a way that it would work with the core distribution's 'Porting/bisect.pl'; see attached. Bisecting showed the following​:

#####
HEAD is now at 13b0f67 re-enable Copy-on-Write by default.
bad - non-zero exit from ./perl -Ilib /home/jkeenan/learn/perl/p5p/116176-regex.pl
13b0f67 is the first bad commit
commit 13b0f67
Author​: David Mitchell <davem@​iabyn.com>
Date​: Wed May 22 16​:38​:29 2013 +0100

  re-enable Copy-on-Write by default.
 
  COW was first introduced (and enabled by default) in 5.17.7.
  It was disabled by default in 5.17.10, because it was though to have too
  many rough edges for the 5.18.0 release.
 
  By re-enabling it now, early in the 5.19.x release cycle, hopefully it
  will be ready for production use by 5.20.
 
  This commit mainly reverts 9f351b4 and e1fd413 (with modifications),
  then updates perldelta.

:100644 100644 1f6e4e469121bf94a7f9ef63617676d1a395a6c3 b33b1c4b7a4a8e984085ec9c51f8a4e6f84b5cd4 M perl.h
:040000 040000 cd20005e6d8f822500e1b92b373ac2efe3dd1ac3 c6d52599ec43ef5985b008c838aa1ef7a4307fb6 M pod
:040000 040000 ca8e7fc7fcf5c038c70c654709673096a7c3335b 2b6529197605edf35cb57d18dd7d0bbb10c295eb M t
bisect run success
That took 1351 seconds.
#####

Confirmation​:

#####
$ git checkout 13b0f67^
$ git show | head -1
commit 13d1b68
[ configure and make as usual ]
$ ./perl -Ilib /home/jkeenan/learn/perl/p5p/116176-a-regex.pl
rv​: 0|$_​: 11ubarb|exp​: 1rhubarb

$ git checkout 13b0f67
$ git show | head -1
commit 13b0f67
[ configure and make as usual ]
$ ./perl -Ilib /home/jkeenan/learn/perl/p5p/116176-a-regex.pl
rv​: 1|$_​: 1rhubarb|exp​: 1rhubarb
#####

I believe this addresses the presenting problem. I will mark this ticket Resolved in 7 days unless I hear otherwise.

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jan 1, 2017

From @jkeenan

116176-a-regex.pl

@p5pRT
Copy link
Author

p5pRT commented Jan 1, 2017

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

@p5pRT
Copy link
Author

p5pRT commented Jan 8, 2017

From @jkeenan

On Sun, 01 Jan 2017 21​:45​:03 GMT, jkeenan wrote​:

On Sat, 22 Dec 2012 16​:25​:09 GMT, tb@​teebee.de wrote​:

This is a bug report for perl from tb@​teebee.de,
generated with the help of perlbug 1.39 running under perl 5.16.2.

-----------------------------------------------------------------
s///e fails if $_ is set inside the replacement section while a
matching m// takes place and $`, $&amp;, or $' are not used. See
the following test cases for details​:

$ perl --version|head -2|tail -1
This is perl 5, version 16, subversion 2 (v5.16.2) built for i686-
linux

$ cat case1.pl
print"case 1\n->";
$&;$_="test";s##$_=//#e;print;
print"<-\n";

$ perl case1.pl
case 1
->1test<-

$ cat case2.pl
print"case 2\n->";
$_="test";s##$_=//#e;print;
print"<-\n";

$ perl case2.pl
case 2
->11st<-

When I ran your 'case2.pl' on perl-5.20 and later, I got the results
you got in your 'case1.pl' -- suggesting that the problem had been
fixed along the way.

I rewrote your 'case2.pl' in a way that it would work with the core
distribution's 'Porting/bisect.pl'; see attached. Bisecting showed
the following​:

#####
HEAD is now at 13b0f67 re-enable Copy-on-Write by default.
bad - non-zero exit from ./perl -Ilib
/home/jkeenan/learn/perl/p5p/116176-regex.pl
13b0f67 is the first bad commit
commit 13b0f67
Author​: David Mitchell <davem@​iabyn.com>
Date​: Wed May 22 16​:38​:29 2013 +0100

re-enable Copy-on-Write by default.

COW was first introduced (and enabled by default) in 5.17.7.
It was disabled by default in 5.17.10, because it was though to have
too
many rough edges for the 5.18.0 release.

By re-enabling it now, early in the 5.19.x release cycle, hopefully it
will be ready for production use by 5.20.

This commit mainly reverts 9f351b4 and e1fd413 (with
modifications),
then updates perldelta.

:100644 100644 1f6e4e469121bf94a7f9ef63617676d1a395a6c3
b33b1c4b7a4a8e984085ec9c51f8a4e6f84b5cd4 M perl.h
:040000 040000 cd20005e6d8f822500e1b92b373ac2efe3dd1ac3
c6d52599ec43ef5985b008c838aa1ef7a4307fb6 M pod
:040000 040000 ca8e7fc7fcf5c038c70c654709673096a7c3335b
2b6529197605edf35cb57d18dd7d0bbb10c295eb M t
bisect run success
That took 1351 seconds.
#####

Confirmation​:

#####
$ git checkout 13b0f67^
$ git show | head -1
commit 13d1b68
[ configure and make as usual ]
$ ./perl -Ilib /home/jkeenan/learn/perl/p5p/116176-a-regex.pl
rv​: 0|$_​: 11ubarb|exp​: 1rhubarb

$ git checkout 13b0f67
$ git show | head -1
commit 13b0f67
[ configure and make as usual ]
$ ./perl -Ilib /home/jkeenan/learn/perl/p5p/116176-a-regex.pl
rv​: 1|$_​: 1rhubarb|exp​: 1rhubarb
#####

I believe this addresses the presenting problem. I will mark this
ticket Resolved in 7 days unless I hear otherwise.

Closing as per schedule.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jan 8, 2017

@jkeenan - 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