[perl-YAML/el5] Fix a couple of bugs
Paul Howarth
pghmcfc at fedoraproject.org
Tue Aug 26 15:02:45 UTC 2014
commit a687d86815f182ffaea9ea7c70f3d1d6d3aace33
Author: Paul Howarth <paul at city-fan.org>
Date: Tue Aug 26 16:02:00 2014 +0100
Fix a couple of bugs
- Fix YAML::Dumper minimum example does not work (#567620, CPAN RT#19838)
- Fix handling of large input data (CPAN RT#90593)
- Drop %defattr, redundant since rpm 4.4
- Don't need to remove empty directories from the buildroot
.gitignore | 2 +-
YAML-0.66-rt19838.patch | 39 +++++++++++++++++++++++++++++++++++++++
YAML-0.66-rt90593.patch | 47 +++++++++++++++++++++++++++++++++++++++++++++++
perl-YAML.spec | 20 ++++++++++++++++----
4 files changed, 103 insertions(+), 5 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 293d018..2bd9484 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-YAML-0.62.tar.gz
+/YAML-[0-9.]*.tar.gz
diff --git a/YAML-0.66-rt19838.patch b/YAML-0.66-rt19838.patch
new file mode 100644
index 0000000..17b8996
--- /dev/null
+++ b/YAML-0.66-rt19838.patch
@@ -0,0 +1,39 @@
+diff --git a/lib/YAML/Dumper.pm b/lib/YAML/Dumper.pm
+index c917f2a..6ad63a4 100644
+--- a/lib/YAML/Dumper.pm
++++ b/lib/YAML/Dumper.pm
+@@ -142,6 +142,7 @@ sub _prewalk {
+ }
+
+ # Handle YAML Blessed things
++ require YAML;
+ if (defined YAML->global_object()->{blessed_map}{$node_id}) {
+ $value = YAML->global_object()->{blessed_map}{$node_id};
+ $self->transferred->{$node_id} = $value;
+diff --git a/t/dump-synopsis.t b/t/dump-synopsis.t
+new file mode 100644
+index 0000000..d65c49a
+--- /dev/null
++++ b/t/dump-synopsis.t
+@@ -0,0 +1,21 @@
++use strict;
++use warnings;
++
++use Test::More tests => 1;
++
++my $success = 0;
++my $err;
++{
++ local $@;
++ eval {
++ require YAML::Dumper;
++ my $hash = {};
++ my $dumper = YAML::Dumper->new();
++ my $string = $dumper->dump($hash);
++ $success = 1;
++ };
++ $err = $@;
++}
++is( $success, 1, "Basic YAML::Dumper usage worked as expected" )
++ or diag( explain($err) );
++
diff --git a/YAML-0.66-rt90593.patch b/YAML-0.66-rt90593.patch
new file mode 100644
index 0000000..e1a7fe9
--- /dev/null
+++ b/YAML-0.66-rt90593.patch
@@ -0,0 +1,47 @@
+--- lib/YAML/Loader.pm
++++ lib/YAML/Loader.pm
+@@ -507,10 +507,27 @@ sub _parse_inline_seq {
+ return $node;
+ }
+
++# Work around /regexp/ bug in perl < 5.10
++sub _parse_inline_double_quoted_perl_bug_work_around {
++ my $self = shift;
++ my @list;
++ local $_ = $self->{inline};
++ s{^"}{} or croak YAML_PARSE_ERR_BAD_DOUBLE();
++ push @list, $1
++ while s{^((?:\\.|[^\"\\]+){1,1000})}{};
++ s/\\"/"/g for @list;
++ s{^"}{} or croak YAML_PARSE_ERR_BAD_DOUBLE();
++ $self->{inline} = $_;
++ return join("", at list);
++}
++
+ # Parse the inline double quoted string.
+ sub _parse_inline_double_quoted {
+ my $self = shift;
+ my $node;
++ # https://rt.cpan.org/Public/Bug/Display.html?id=18195
++ return $self->_parse_inline_double_quoted_perl_bug_work_around()
++ if length($self->{inline}) > 10_000;
+ if ($self->inline =~ /^"((?:\\"|[^"])*)"\s*(.*)$/) {
+ $node = $1;
+ $self->inline($2);
+--- t/rt-90593.t
++++ t/rt-90593.t
+@@ -0,0 +1,14 @@
++# https://rt.cpan.org/Public/Bug/Display.html?id=90593
++use Test::More tests => 2;
++
++use YAML;
++use constant LENGTH => 1000000;
++
++$SIG{__WARN__} = sub { die @_ };
++
++my $yaml = 'x: "' . ('x' x LENGTH) . '"' . "\n";
++
++my $hash = Load $yaml;
++
++is ref($hash), 'HASH', 'Loaded a hash';
++is length($hash->{x}), LENGTH, 'Long scalar loaded';
diff --git a/perl-YAML.spec b/perl-YAML.spec
index ffc9c26..6bac979 100644
--- a/perl-YAML.spec
+++ b/perl-YAML.spec
@@ -1,11 +1,13 @@
Name: perl-YAML
Version: 0.66
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: YAML Ain't Markup Language (tm)
License: GPL+ or Artistic
Group: Development/Libraries
URL: http://search.cpan.org/dist/YAML/
Source0: http://www.cpan.org/authors/id/I/IN/INGY/YAML-%{version}.tar.gz
+Patch0: YAML-0.66-rt19838.patch
+Patch1: YAML-0.66-rt90593.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: perl(ExtUtils::MakeMaker)
@@ -23,6 +25,12 @@ specification.
%prep
%setup -q -n YAML-%{version}
+# Fix YAML::Dumper minimum example does not work (#567620, CPAN RT#19838)
+%patch0 -p1
+
+# Fix handling of large input data (CPAN RT#18195, CPAN RT#90593)
+%patch1
+
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor < /dev/null
make %{?_smp_mflags}
@@ -39,7 +47,6 @@ rm -f $RPM_BUILD_ROOT%{perl_vendorlib}/Test/YAML* \
$RPM_BUILD_ROOT%{_mandir}/man3/Test::YAML*.3*
find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
-find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \;
%{_fixperms} $RPM_BUILD_ROOT/*
@@ -50,7 +57,6 @@ make test
rm -rf $RPM_BUILD_ROOT
%files
-%defattr(-,root,root,-)
%doc Changes COMPATIBILITY README
%{_bindir}/ysh
%{perl_vendorlib}/YAML*
@@ -58,6 +64,12 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/YAML*.3*
%changelog
+* Tue Aug 26 2014 Paul Howarth <paul at city-fan.org> 0.66-3
+- Fix YAML::Dumper minimum example does not work (#567620, CPAN RT#19838)
+- Fix handling of large input data (CPAN RT#90593)
+- Drop %%defattr, redundant since rpm 4.4
+- Don't need to remove empty directories from the buildroot
+
* Fri Jan 11 2008 Tom "spot" Callaway <tcallawa at redhat.com> 0.66-2
- rebuild for new perl
@@ -97,7 +109,7 @@ rm -rf $RPM_BUILD_ROOT
* Thu Apr 14 2005 Ville Skyttä <ville.skytta at iki.fi> - 0.39-2
- 0.39.
-* Fri Apr 7 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
+* Wed Apr 6 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
- rebuilt
* Sat May 15 2004 Jose Pedro Oliveira <jpo at di.uminho.pt> - 0:0.35-0.fdr.5
More information about the perl-devel
mailing list