Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the YAML CPAN distribution.

Report information
The Basics
Id: 62258
Status: resolved
Priority: 0/
Queue: YAML

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

Bug Information
Severity: Normal
Broken in: 0.72
Fixed in: 0.73



Subject: Bleadperl fb85c04 breaks CPAN
Sorry for the spam. See http://rt.perl.org/rt3/Ticket/Display.html?id=78008 for more details.
Patch uploaded to CPAN: ANDK/patches/YAML-0.72-ANDK-01.patch.gz Works with old and new perls. The patch moves the dangerous tests into new files that are then duplicated, adjusted for new perls and finally skipped on "the wrong" perls. There may exist more intelligent ways of dealing with the situation but I chose this one that is easy to follow. A distroprefs file that applies this patch is also available at https://github.com/andk/cpanpm/blob/master/distroprefs/INGY.YAML.yml Enjoy,
Attaching patch. The directory was not easy to find.
Subject: YAML-0.72-ANDK-01.patch
diff -ur YAML-0.72-zWbVhp~/lib/YAML/Types.pm YAML-0.72-zWbVhp/lib/YAML/Types.pm --- YAML-0.72-zWbVhp~/lib/YAML/Types.pm 2010-09-01 04:03:12.000000000 +0200 +++ YAML-0.72-zWbVhp/lib/YAML/Types.pm 2010-11-07 09:45:33.000000000 +0100 @@ -219,9 +219,10 @@ sub yaml_load { my $self = shift; my ($node, $class) = @_; - return qr{$node} unless $node =~ /^\(\?([\-xism]*):(.*)\)\z/s; + return qr{$node} unless $node =~ /^\(\?([\^\-xism]*):(.*)\)\z/s; my ($flags, $re) = ($1, $2); $flags =~ s/-.*//; + $flags =~ s/^\^//; my $sub = _QR_TYPES->{$flags} || sub { qr{$_[0]} }; my $qr = &$sub($re); bless $qr, $class if length $class; diff -ur YAML-0.72-zWbVhp~/MANIFEST YAML-0.72-zWbVhp/MANIFEST --- YAML-0.72-zWbVhp~/MANIFEST 2010-09-01 04:04:13.000000000 +0200 +++ YAML-0.72-zWbVhp/MANIFEST 2010-11-07 11:24:40.000000000 +0100 @@ -74,3 +74,7 @@ xt/meta.t xt/pmv.t xt/pod.t +t/dump-perl-types-512.t +t/dump-perl-types-514.t +t/dump-tests-512.t +t/dump-tests-514.t diff -ur YAML-0.72-zWbVhp~/t/dump-perl-types-512.t YAML-0.72-zWbVhp/t/dump-perl-types-512.t --- YAML-0.72-zWbVhp~/t/dump-perl-types-512.t 2010-11-07 11:28:37.000000000 +0100 +++ YAML-0.72-zWbVhp/t/dump-perl-types-512.t 2010-11-07 11:11:14.000000000 +0100 @@ -0,0 +1,26 @@ +use Test::More; +BEGIN { + if ( qr/x/ =~ /\(\?\^/ ){ + plan skip_all => "test only for perls before v5.13.5-11-gfb85c04"; + } +} +use t::TestYAML tests => 2; + +filters { perl => ['eval', 'yaml_dump'] }; + +no_diff; +run_is ( perl => 'yaml' ); + +__DATA__ +=== Regular Expression ++++ perl: qr{perfect match}; ++++ yaml +--- !!perl/regexp (?-xism:perfect match) + +=== Regular Expression with newline ++++ perl +qr{perfect +match}x; ++++ yaml +--- !!perl/regexp "(?x-ism:perfect\nmatch)" + diff -ur YAML-0.72-zWbVhp~/t/dump-perl-types-514.t YAML-0.72-zWbVhp/t/dump-perl-types-514.t --- YAML-0.72-zWbVhp~/t/dump-perl-types-514.t 2010-11-07 11:28:37.000000000 +0100 +++ YAML-0.72-zWbVhp/t/dump-perl-types-514.t 2010-11-07 11:16:32.000000000 +0100 @@ -0,0 +1,26 @@ +use Test::More; +BEGIN { + unless ( qr/x/ =~ /\(\?\^/ ){ + plan skip_all => "test only for perls v5.13.5-11-gfb85c04 or later"; + } +} +use t::TestYAML tests => 2; + +filters { perl => ['eval', 'yaml_dump'] }; + +no_diff; +run_is ( perl => 'yaml' ); + +__DATA__ +=== Regular Expression ++++ perl: qr{perfect match}; ++++ yaml +--- !!perl/regexp (?^:perfect match) + +=== Regular Expression with newline ++++ perl +qr{perfect +match}x; ++++ yaml +--- !!perl/regexp "(?^x:perfect\nmatch)" + diff -ur YAML-0.72-zWbVhp~/t/dump-perl-types.t YAML-0.72-zWbVhp/t/dump-perl-types.t --- YAML-0.72-zWbVhp~/t/dump-perl-types.t 2010-09-01 04:03:12.000000000 +0200 +++ YAML-0.72-zWbVhp/t/dump-perl-types.t 2010-11-07 09:49:58.000000000 +0100 @@ -1,4 +1,4 @@ -use t::TestYAML tests => 16; +use t::TestYAML tests => 14; filters { perl => ['eval', 'yaml_dump'] }; @@ -46,18 +46,6 @@ --- !!perl/ref =: Goodbye -=== Regular Expression -+++ perl: qr{perfect match}; -+++ yaml ---- !!perl/regexp (?-xism:perfect match) - -=== Regular Expression with newline -+++ perl -qr{perfect -match}x; -+++ yaml ---- !!perl/regexp "(?x-ism:perfect\nmatch)" - === Scalar Glob +++ perl $::var = 'Hola'; diff -ur YAML-0.72-zWbVhp~/t/dump-tests-512.t YAML-0.72-zWbVhp/t/dump-tests-512.t --- YAML-0.72-zWbVhp~/t/dump-tests-512.t 2010-11-07 11:28:37.000000000 +0100 +++ YAML-0.72-zWbVhp/t/dump-tests-512.t 2010-11-07 11:11:51.000000000 +0100 @@ -0,0 +1,22 @@ +use Test::More; +BEGIN { + if ( qr/x/ =~ /\(\?\^/ ){ + plan skip_all => "test only for perls before v5.13.5-11-gfb85c04"; + } +} +use t::TestYAML tests => 1; + +no_diff(); +run_roundtrip_nyn('dumper'); + +__DATA__ +=== ++++ no_round_trip +Since we don't use eval for regexp reconstitution any more (for safety +sake) this test doesn't roundtrip even though the values are equivalent. ++++ perl +[qr{bozo$}i] ++++ yaml +--- +- !!perl/regexp (?i-xsm:bozo$) + diff -ur YAML-0.72-zWbVhp~/t/dump-tests-514.t YAML-0.72-zWbVhp/t/dump-tests-514.t --- YAML-0.72-zWbVhp~/t/dump-tests-514.t 2010-11-07 11:28:37.000000000 +0100 +++ YAML-0.72-zWbVhp/t/dump-tests-514.t 2010-11-07 11:18:06.000000000 +0100 @@ -0,0 +1,22 @@ +use Test::More; +BEGIN { + unless ( qr/x/ =~ /\(\?\^/ ){ + plan skip_all => "test only for perls v5.13.5-11-gfb85c04 or later"; + } +} +use t::TestYAML tests => 1; + +no_diff(); +run_roundtrip_nyn('dumper'); + +__DATA__ +=== ++++ no_round_trip +Since we don't use eval for regexp reconstitution any more (for safety +sake) this test doesn't roundtrip even though the values are equivalent. ++++ perl +[qr{bozo$}i] ++++ yaml +--- +- !!perl/regexp (?^i:bozo$) + diff -ur YAML-0.72-zWbVhp~/t/dump-tests.t YAML-0.72-zWbVhp/t/dump-tests.t --- YAML-0.72-zWbVhp~/t/dump-tests.t 2010-09-01 04:03:12.000000000 +0200 +++ YAML-0.72-zWbVhp/t/dump-tests.t 2010-11-07 09:50:16.000000000 +0100 @@ -1,4 +1,4 @@ -use t::TestYAML tests => 58; +use t::TestYAML tests => 57; no_diff(); run_roundtrip_nyn('dumper'); @@ -304,16 +304,6 @@ foo: 42 === -+++ no_round_trip -Since we don't use eval for regexp reconstitution any more (for safety -sake) this test doesn't roundtrip even though the values are equivalent. -+++ perl -[qr{bozo$}i] -+++ yaml ---- -- !!perl/regexp (?i-xsm:bozo$) - -=== +++ perl [undef, undef] +++ yaml diff -ur YAML-0.72-zWbVhp~/t/regexp.t YAML-0.72-zWbVhp/t/regexp.t --- YAML-0.72-zWbVhp~/t/regexp.t 2010-09-01 04:03:12.000000000 +0200 +++ YAML-0.72-zWbVhp/t/regexp.t 2010-11-07 09:49:26.000000000 +0100 @@ -2,16 +2,22 @@ use YAML(); no warnings 'once'; +my $m_xis = "m-xis"; +my $_xism = "-xism"; +if (qr/x/ =~ /\(\?\^/){ + $m_xis = "^m"; + $_xism = "^"; +} my @blocks = blocks; my $block = $blocks[0]; $YAML::UseCode = 1; my $hash = YAML::Load($block->yaml); -is $hash->{key}, '(?m-xis:foo$)', 'Regexps load'; -is YAML::Dump(eval $block->perl), <<'...', 'Regexps dump'; +is $hash->{key}, "(?$m_xis:foo\$)", 'Regexps load'; +is YAML::Dump(eval $block->perl), <<"...", 'Regexps dump'; --- -key: !!perl/regexp (?m-xis:foo$) +key: !!perl/regexp (?$m_xis:foo\$) ... my $re = $hash->{key}; @@ -25,13 +31,13 @@ $block = $blocks[1]; $hash = YAML::Load($block->yaml); -is $hash->{key}, '(?m-xis:foo$)', 'Regexps load'; +is $hash->{key}, "(?$m_xis:foo\$)", 'Regexps load'; # XXX Dumper can't detect a blessed regexp -# is YAML::Dump(eval $block->perl), <<'...', 'Regexps dump'; +# is YAML::Dump(eval $block->perl), <<"...", 'Regexps dump'; # --- -# key: !!perl/regexp (?m-xis:foo$) +# key: !!perl/regexp (?$m_xis:foo\$) # ... $re = $hash->{key}; @@ -48,11 +54,11 @@ $block = $blocks[2]; $hash = YAML::Load($block->yaml); -is $hash->{key}, '(?-xism:foo$)', 'Regexps load'; +is $hash->{key}, "(?$_xism:foo\$)", 'Regexps load'; -is YAML::Dump(eval $block->perl), <<'...', 'Regexps dump'; +is YAML::Dump(eval $block->perl), <<"...", 'Regexps dump'; --- -key: !!perl/regexp (?-xism:foo$) +key: !!perl/regexp (?$_xism:foo\$) ... $re = $hash->{key};
Perl 5.13.10 rolled out and this still hasn't been fixed. A patch is available, can haz release plz? :)
Ping... 5.14.0 is near... Regards, Slaven
This issue has been copied to: https://github.com/ingydotnet/yaml-pm/issues/108 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.
Seems this was fixed in 0.73