Skip Menu |

This queue is for tickets about the Data-Dumper-Compact CPAN distribution.

Report information
The Basics
Id: 130339
Status: patched
Priority: 0/
Queue: Data-Dumper-Compact

People
Owner: Nobody in particular
Requestors: CXW [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.004000
Fixed in: (no value)



Subject: Unescaped left brace in regex when $spare = -1
In v0.004000, line 287 reads: if ($f =~ s/^(.{0,${spare}})\n//sm) { I have some data that happens to set $spare to -1. (I am sorry to say I have not yet been able to devise a repro - https://github.com/cxw42/git-find/tree/ddc-bug-maybe is where I am experimenting.) When $spare == -1, Perl thinks that the {N,M} is literal braces - see brian d foy's https://www.effectiveperlprogramming.com/2018/12/perl-v5-30-lets-you-match-more-with-the-general-quantifier/ . The message is: Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/^(.{ <-- HERE 0,-1})\n/ at /home/cxw/perl5/lib/perl5/Data/Dumper/Compact.pm line 288. Thank you for considering this report! Cygwin Perl 5.26.3 x64
I have a repro! It is attached - testing.pl. On my Perl 5.26.3, I can do: $ cpanm Carp::Always ... $ cpanm Data::Dumper::Compact --> Working on Data::Dumper::Compact Fetching http://www.cpan.org/authors/id/M/MS/MSTROUT/Data-Dumper-Compact-0.004000.tar.gz ... OK Configuring Data-Dumper-Compact-0.004000 ... OK Building and testing Data-Dumper-Compact-0.004000 ... OK Successfully installed Data-Dumper-Compact-0.004000 1 distribution installed $ perl testing.pl Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/^(.{ <-- HERE 0,-1})\n/ at /home/cxw/perl5/lib/perl5/Data/Dumper/Compact.pm line 287. <stacktrace...> Thank you for considering this report! Chris On Mon Aug 19 22:20:11 2019, CXW wrote: Show quoted text
> In v0.004000, line 287 reads: > > if ($f =~ s/^(.{0,${spare}})\n//sm) { > > I have some data that happens to set $spare to -1. (I am sorry to say > I have not yet been able to devise a repro - > https://github.com/cxw42/git-find/tree/ddc-bug-maybe is where I am > experimenting.) > > When $spare == -1, Perl thinks that the {N,M} is literal braces - see > brian d foy's https://www.effectiveperlprogramming.com/2018/12/perl- > v5-30-lets-you-match-more-with-the-general-quantifier/ . The message > is: > > Unescaped left brace in regex is deprecated here (and will be fatal in > Perl 5.30), passed through in regex; marked by <-- HERE in m/^(.{ <-- > HERE 0,-1})\n/ at /home/cxw/perl5/lib/perl5/Data/Dumper/Compact.pm > line 288. > > Thank you for considering this report! > > Cygwin Perl 5.26.3 x64
Subject: testing.pl
package App::GitFind::Actions; use warnings; use strict; use 5.010; use constant true => 1; sub dot_relative_path { } our $target1 = sub { true }; our $target2 = sub { say $_[0]->dot_relative_path($_[1]); }; package main; use Carp::Always; use Data::Dumper::Compact 'ddc'; use v5.10; my $inner1 = {code=>$App::GitFind::Actions::target1, index => 1, name => 'true'}; my $inner2 = {code=>$App::GitFind::Actions::target2, name => 'print'}; my $expr = {AND=>[$inner1, $inner2]}; my $switches = {v=>[1,1]}; say ddc({expr=>$expr, switches=>$switches});
Another sample data that triggers this bug (in YAML): --- priority: -2 type: master records: - {owner: '', ttl: 3600, type: SOA, host: '', email: hostmaster@aaaaaaaaaaaa.com, serial: 2019012402, refresh: 7200, retry: 1800, expire: 1209600, ttl: 300} - {owner: '', ttl: ~, type: NS, host: 'dns1.aaaaaaaaa.com'} - {owner: '', ttl: ~, type: NS, host: 'dns2.aaaaaaaaa.net'} - {owner: '', ttl: ~, type: NS, host: 'dns3.aaaaaaaaaaaa.com'} - {owner: '', ttl: ~, type: NS, host: 'dns4.aaaaaaaaa.com'} ---
Matt, thanks! 0.004001 fixes my test case. PERLANCAR, I copied your data (between the hyphen lines) into foo.yml and ran perl -MYAML::XS=LoadFile -MData::Dumper::Compact=ddc -E 'say ddc LoadFile "foo.yml"' I got reasonable output, and no deprecation warning. I think we can mark this as fixed. Do you agree? Chris On Mon Sep 09 04:22:09 2019, PERLANCAR wrote: Show quoted text
> Another sample data that triggers this bug (in YAML): > > --- > priority: -2 > type: master > records: > - {owner: '', ttl: 3600, type: SOA, host: '', email: > hostmaster@aaaaaaaaaaaa.com, serial: 2019012402, refresh: 7200, retry: > 1800, expire: 1209600, ttl: 300} > - {owner: '', ttl: ~, type: NS, host: 'dns1.aaaaaaaaa.com'} > - {owner: '', ttl: ~, type: NS, host: 'dns2.aaaaaaaaa.net'} > - {owner: '', ttl: ~, type: NS, host: 'dns3.aaaaaaaaaaaa.com'} > - {owner: '', ttl: ~, type: NS, host: 'dns4.aaaaaaaaa.com'} > ---