Skip Menu |
Report information
Id: 131867
Status: open
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: abigail [at] abigail.be
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: medium
Type: core
Perl Version: 5.26.0
Fixed In: (no value)



To: perlbug [...] perl.org
Date: Wed, 9 Aug 2017 13:27:17 +0200
Subject: %{^CAPTURE_ALL} is %+, not %-.
From: Abigail <abigail [...] abigail.be>
Download (untitled) / with headers
text/plain 4.3k
This is a bug report for perl from abigail@abigail.be, generated with the help of perlbug 1.40 running under perl 5.26.0. ----------------------------------------------------------------- [Please describe your issue here] perlvar states that %{^CAPTURE_ALL} is an alias to %-. But it isn't, it's an alias to %+ (just like %{^CAPTURE} is). #!/opt/perl/bin/perl use 5.026; use strict; use warnings; no warnings 'syntax'; "AB" =~ /(?<letter>A)(?<letter>B)/; use Data::Dumper; print Dumper (\%-); print Dumper (\%{^CAPTURE_ALL}); print Dumper (\%+); __END__ $VAR1 = { 'letter' => [ 'A', 'B' ] }; $VAR1 = { 'letter' => 'A' }; $VAR1 = { 'letter' => 'A' }; This issue is still present in blead. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=medium --- Site configuration information for perl 5.26.0: Configured by abigail at Wed Jun 7 23:04:17 CEST 2017. Summary of my perl5 (revision 5 version 26 subversion 0) configuration: Platform: osname=darwin osvers=15.6.0 archname=darwin-ld-2level uname='darwin athena 15.6.0 darwin kernel version 15.6.0: thu jun 23 18:25:34 pdt 2016; root:xnu-3248.60.10~1release_x86_64 x86_64 ' config_args='-des -Uversiononly -Dperladmin=abigail@abigail.be -Dcf_email=abigail@abigail.be -Dmydomain=abigail.be -Dcc=gcc -Dprefix=/opt/perl/5.26.0 -Dusedevel -Dusemorebits' hint=recommended useposix=true d_sigaction=define useithreads=undef usemultiplicity=undef use64bitint=define use64bitall=define uselongdouble=define usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='gcc' ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -mmacosx-version-min=10.11 -fno-strict-aliasing -pipe -fstack-protector-strong -I/opt/local/include -DPERL_USE_SAFE_PUTENV' optimize='-O3' cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -mmacosx-version-min=10.11 -fno-strict-aliasing -pipe -fstack-protector-strong -I/opt/local/include' ccversion='' gccversion='4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)' 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='long double' nvsize=16 Off_t='off_t' lseeksize=8 alignbytes=16 prototype=define Linker and Libraries: ld='gcc' ldflags =' -mmacosx-version-min=10.11 -fstack-protector-strong -L/opt/local/lib' libpth=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib /opt/local/lib /usr/lib libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc perllibs=-lpthread -ldl -lm -lutil -lc libc= so=dylib useshrplib=false libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=bundle d_dlsymun=undef ccdlflags=' ' cccdlflags=' ' lddlflags=' -mmacosx-version-min=10.11 -bundle -undefined dynamic_lookup -L/opt/local/lib -fstack-protector-strong' --- @INC for perl 5.26.0: /Users/abigail/Perl/CPAN/Regexp-Common2/lib /Users/abigail/Perl/CPAN/Test-Regexp/lib /opt/perl/5.26.0/lib/site_perl/5.26.0/darwin-ld-2level /opt/perl/5.26.0/lib/site_perl/5.26.0 /opt/perl/5.26.0/lib/5.26.0/darwin-ld-2level /opt/perl/5.26.0/lib/5.26.0 --- Environment for perl 5.26.0: DYLD_LIBRARY_PATH (unset) HOME=/Users/abigail LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH=/Users/abigail/Lib:/usr/local/lib:/usr/lib:/lib:/usr/X11R6/lib LOGDIR (unset) PATH=/Users/abigail/Bin:/opt/perl/bin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/games:/opt/git/bin:/Users/abigail/Perl/Photos:/Users/abigail/Perl/Bin:/opt/mysql/bin:/opt/local/bin:/Users/abigail/bin PERL5LIB=/Users/abigail/Perl/CPAN/Regexp-Common2/lib:/Users/abigail/Perl/CPAN/Test-Regexp/lib PERLDIR=/opt/perl PERL_BADLANG (unset) SHELL=/bin/bash
Date: Wed, 9 Aug 2017 07:40:28 -0400
To: perl5-porters [...] perl.org
From: James E Keenan <jkeenan [...] pobox.com>
Subject: Re: [perl #131867] %{^CAPTURE_ALL} is %+, not %-.
Download (untitled) / with headers
text/plain 1.2k
On 08/09/2017 07:32 AM, Abigail wrote: Show quoted text
> # New Ticket Created by Abigail > # Please include the string: [perl #131867] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=131867 > > > > > This is a bug report for perl from abigail@abigail.be, > generated with the help of perlbug 1.40 running under perl 5.26.0. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > perlvar states that %{^CAPTURE_ALL} is an alias to %-. > But it isn't, it's an alias to %+ (just like %{^CAPTURE} is). > > > #!/opt/perl/bin/perl > > use 5.026; > > use strict; > use warnings; > no warnings 'syntax'; > > > "AB" =~ /(?<letter>A)(?<letter>B)/; > > use Data::Dumper; > print Dumper (\%-); > print Dumper (\%{^CAPTURE_ALL}); > print Dumper (\%+); > > __END__ > $VAR1 = { > 'letter' => [ > 'A', > 'B' > ] > }; > $VAR1 = { > 'letter' => 'A' > }; > $VAR1 = { > 'letter' => 'A' > }; > > > This issue is still present in blead. > >
Is this just a documentation error or is the implementation itself wrong?
Subject: Re: [perl #131867] %{^CAPTURE_ALL} is %+, not %-.
From: Abigail <abigail [...] abigail.be>
Date: Wed, 9 Aug 2017 15:15:29 +0200
To: James E Keenan via RT <perlbug-followup [...] perl.org>
Download (untitled) / with headers
text/plain 388b
On Wed, Aug 09, 2017 at 04:41:04AM -0700, James E Keenan via RT wrote: Show quoted text
> On 08/09/2017 07:32 AM, Abigail wrote: > > Is this just a documentation error or is the implementation itself wrong? >
The implemenation it wrong; %+ already has an alias, %{^CAPTURE}. %{^CAPTURE_ALL} is intended to be an alias for %-, instead of a second alias for %+, leaving %- without an alias. Abigail
To: perl5-porters [...] perl.org
Date: Wed, 9 Aug 2017 15:00:03 -0400
Subject: Re: [perl #131867] %{^CAPTURE_ALL} is %+, not %-.
From: James E Keenan <jkeenan [...] pobox.com>
Download (untitled) / with headers
text/plain 570b
On 08/09/2017 09:15 AM, Abigail wrote: Show quoted text
> On Wed, Aug 09, 2017 at 04:41:04AM -0700, James E Keenan via RT wrote:
>> On 08/09/2017 07:32 AM, Abigail wrote: >> >> Is this just a documentation error or is the implementation itself wrong? >>
> > > The implemenation it wrong; %+ already has an alias, %{^CAPTURE}. > %{^CAPTURE_ALL} is intended to be an alias for %-, instead of > a second alias for %+, leaving %- without an alias. > >
Will we have to have a deprecation cycle in order to correct this problem? (From what I understand, yes.) Thank you very much. jimk
CC: Perl5 Porteros <perl5-porters [...] perl.org>
Date: Thu, 10 Aug 2017 14:23:20 +0200
Subject: Re: [perl #131867] %{^CAPTURE_ALL} is %+, not %-.
From: demerphq <demerphq [...] gmail.com>
To: James E Keenan <jkeenan [...] pobox.com>
Download (untitled) / with headers
text/plain 780b
On 9 Aug 2017 15:00, "James E Keenan" <jkeenan@pobox.com> wrote:
Show quoted text
On 08/09/2017 09:15 AM, Abigail wrote:
On Wed, Aug 09, 2017 at 04:41:04AM -0700, James E Keenan via RT wrote:
On 08/09/2017 07:32 AM, Abigail wrote:

Is this just a documentation error or is the implementation itself wrong?



The implemenation it wrong; %+ already has an alias, %{^CAPTURE}.
%{^CAPTURE_ALL} is intended to be an alias for %-, instead of
a second alias for %+, leaving %- without an alias.



Will we have to have a deprecation cycle in order to correct this problem?

(From what I understand, yes.)


No I don't think so. This was just a stupid oversight. The docs are correct the implementation is broken.

My bad. Sorry about this.

Yves
Show quoted text

Thank you very much.
jimk

Date: Sat, 12 Aug 2017 12:19:29 +0200
To: yves orton via RT <perlbug-followup [...] perl.org>
Subject: Re: [perl #131867] %{^CAPTURE_ALL} is %+, not %-.
From: Abigail <abigail [...] abigail.be>
Download (untitled) / with headers
text/plain 1.1k
On Thu, Aug 10, 2017 at 05:23:50AM -0700, yves orton via RT wrote: Show quoted text
> On 9 Aug 2017 15:00, "James E Keenan" <jkeenan@pobox.com> wrote: > > On 08/09/2017 09:15 AM, Abigail wrote: >
> > On Wed, Aug 09, 2017 at 04:41:04AM -0700, James E Keenan via RT wrote: > >
> >> On 08/09/2017 07:32 AM, Abigail wrote: > >> > >> Is this just a documentation error or is the implementation itself wrong? > >> > >>
> > > > The implemenation it wrong; %+ already has an alias, %{^CAPTURE}. > > %{^CAPTURE_ALL} is intended to be an alias for %-, instead of > > a second alias for %+, leaving %- without an alias. > > > > > >
> Will we have to have a deprecation cycle in order to correct this problem? > > (From what I understand, yes.) > > > > No I don't think so. This was just a stupid oversight. The docs are correct > the implementation is broken.
I agree with Yves. It's new in 5.26.0. I haven't looked how it's implemented yet, but I wouldn't be surprised if it's a one character fix. If possible, it should get fixed in 5.26.1. Show quoted text
> > My bad. Sorry about this. >
Don't fret it. Stuff happens; I only found this issue when writing my slides for YAPC::EU. Abigail
To: Abigail <abigail [...] abigail.be>, yves orton via RT <perlbug-followup [...] perl.org>
Date: Sun, 13 Aug 2017 16:24:08 +0200
Subject: Re: [perl #131867] %{^CAPTURE_ALL} is %+, not %-.
From: Sawyer X <xsawyerx [...] gmail.com>
Download (untitled) / with headers
text/plain 1.3k
On 08/12/2017 12:19 PM, Abigail wrote: Show quoted text
> On Thu, Aug 10, 2017 at 05:23:50AM -0700, yves orton via RT wrote:
>> On 9 Aug 2017 15:00, "James E Keenan" <jkeenan@pobox.com> wrote: >> >> On 08/09/2017 09:15 AM, Abigail wrote: >>
>>> On Wed, Aug 09, 2017 at 04:41:04AM -0700, James E Keenan via RT wrote: >>>
>>>> On 08/09/2017 07:32 AM, Abigail wrote: >>>> >>>> Is this just a documentation error or is the implementation itself wrong? >>>> >>>>
>>> The implemenation it wrong; %+ already has an alias, %{^CAPTURE}. >>> %{^CAPTURE_ALL} is intended to be an alias for %-, instead of >>> a second alias for %+, leaving %- without an alias. >>> >>> >>>
>> Will we have to have a deprecation cycle in order to correct this problem? >> >> (From what I understand, yes.) >> >> >> >> No I don't think so. This was just a stupid oversight. The docs are correct >> the implementation is broken.
> > I agree with Yves. It's new in 5.26.0. I haven't looked how it's implemented > yet, but I wouldn't be surprised if it's a one character fix. If possible, > it should get fixed in 5.26.1.
I agree. We already intend for it to provide a certain behavior based on documentation and all announcements. This should be classified as a bug and since it's new, we can't argue people heavily use it at this point. Otherwise, they would have provided a ticket. as Abigail did.
Date: Sun, 13 Aug 2017 09:48:27 -0600
Subject: Re: [perl #131867] %{^CAPTURE_ALL} is %+, not %-.
From: Karl Williamson <public [...] khwilliamson.com>
To: Sawyer X <xsawyerx [...] gmail.com>, Abigail <abigail [...] abigail.be>, yves orton via RT <perlbug-followup [...] perl.org>
Download (untitled) / with headers
text/plain 1.5k
On 08/13/2017 08:24 AM, Sawyer X wrote: Show quoted text
> > > On 08/12/2017 12:19 PM, Abigail wrote:
>> On Thu, Aug 10, 2017 at 05:23:50AM -0700, yves orton via RT wrote:
>>> On 9 Aug 2017 15:00, "James E Keenan" <jkeenan@pobox.com> wrote: >>> >>> On 08/09/2017 09:15 AM, Abigail wrote: >>>
>>>> On Wed, Aug 09, 2017 at 04:41:04AM -0700, James E Keenan via RT wrote: >>>>
>>>>> On 08/09/2017 07:32 AM, Abigail wrote: >>>>> >>>>> Is this just a documentation error or is the implementation itself wrong? >>>>> >>>>>
>>>> The implemenation it wrong; %+ already has an alias, %{^CAPTURE}. >>>> %{^CAPTURE_ALL} is intended to be an alias for %-, instead of >>>> a second alias for %+, leaving %- without an alias. >>>> >>>> >>>>
>>> Will we have to have a deprecation cycle in order to correct this problem? >>> >>> (From what I understand, yes.) >>> >>> >>> >>> No I don't think so. This was just a stupid oversight. The docs are correct >>> the implementation is broken.
>> >> I agree with Yves. It's new in 5.26.0. I haven't looked how it's implemented >> yet, but I wouldn't be surprised if it's a one character fix. If possible, >> it should get fixed in 5.26.1.
> > I agree. > > We already intend for it to provide a certain behavior based on > documentation and all announcements. This should be classified as a bug > and since it's new, we can't argue people heavily use it at this point. > Otherwise, they would have provided a ticket. as Abigail did. >
We have agreed in past releases that new features are eligible for patches in a dot release; otherwise they aren't usable until the next major one, which is absurd.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 152b
This is a simple fix - I assume that _tie_it is used by core only and can rely on the name of GV. The patch also adds few tests for the named variables.
Subject: blead-capture_all.patch
diff --git a/ext/Tie-Hash-NamedCapture/NamedCapture.xs b/ext/Tie-Hash-NamedCapture/NamedCapture.xs index 7eaae5614d..a607c10090 100644 --- a/ext/Tie-Hash-NamedCapture/NamedCapture.xs +++ b/ext/Tie-Hash-NamedCapture/NamedCapture.xs @@ -25,8 +25,11 @@ _tie_it(SV *sv) GV * const gv = (GV *)sv; HV * const hv = GvHVn(gv); SV *rv = newSV_type(SVt_RV); + const char *gv_name = GvNAME(gv); CODE: - SvRV_set(rv, newSVuv(*GvNAME(gv) == '-' ? RXapif_ALL : RXapif_ONE)); + SvRV_set(rv, newSVuv( + strEQ(gv_name, "-") || strEQ(gv_name, "\003APTURE_ALL") + ? RXapif_ALL : RXapif_ONE)); SvROK_on(rv); sv_bless(rv, GvSTASH(CvGV(cv))); diff --git a/ext/Tie-Hash-NamedCapture/t/tiehash.t b/ext/Tie-Hash-NamedCapture/t/tiehash.t index 3ebc81ad68..962754085f 100644 --- a/ext/Tie-Hash-NamedCapture/t/tiehash.t +++ b/ext/Tie-Hash-NamedCapture/t/tiehash.t @@ -3,7 +3,12 @@ use strict; use Test::More; -my %hashes = ('+' => \%+, '-' => \%-); +my %hashes = ( + '+' => \%+, + '-' => \%-, + '{^CAPTURE}' => \%{^CAPTURE}, + '{^CAPTURE_ALL}' => \%{^CAPTURE_ALL}, +); foreach (['plus1'], ['minus1', all => 1], @@ -20,12 +25,12 @@ foreach (['plus1'], is("abcdef" =~ /(?<foo>[ab])*(?<bar>c)(?<foo>d)(?<bar>[ef]*)/, 1, "We matched"); -foreach my $name (qw(+ plus1 plus2 plus3)) { +foreach my $name (qw(+ {^CAPTURE} plus1 plus2 plus3)) { my $hash = $hashes{$name}; is_deeply($hash, { foo => 'b', bar => 'c' }, "%$name is as expected"); } -foreach my $name (qw(- minus1 minus2)) { +foreach my $name (qw(- {^CAPTURE_ALL} minus1 minus2)) { my $hash = $hashes{$name}; is_deeply($hash, { foo => [qw(b d)], bar => [qw(c ef)] }, "%$name is as expected");
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 377b
On Fri, 22 Sep 2017 16:41:03 GMT, kent-perl@setattr.net wrote: Show quoted text
> This is a simple fix - I assume that _tie_it is used by core only and > can rely on the name of GV. The patch also adds few tests for the > named variables.
This patch is available for smoke testing in this branch: smoke-me/jkeenan/131867-capture-all Thank you very much. -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 262b
On Fri, 22 Sep 2017 09:41:03 -0700, kent-perl@setattr.net wrote: Show quoted text
> This is a simple fix - I assume that _tie_it is used by core only and > can rely on the name of GV.
I can confirm that only the core uses (is supposed to use) _tie_it. -- Father Chrysostomos


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