diff options
Diffstat (limited to 'meta/recipes-devtools/perl/perl/debian/fixes/memoize_storable_nstore.diff')
-rw-r--r-- | meta/recipes-devtools/perl/perl/debian/fixes/memoize_storable_nstore.diff | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/meta/recipes-devtools/perl/perl/debian/fixes/memoize_storable_nstore.diff b/meta/recipes-devtools/perl/perl/debian/fixes/memoize_storable_nstore.diff deleted file mode 100644 index d9b36f6d23..0000000000 --- a/meta/recipes-devtools/perl/perl/debian/fixes/memoize_storable_nstore.diff +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | From 55d430eb02fc116581847304ca20321687978269 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jonathan Nieder <jrnieder@gmail.com> | ||
3 | Date: Fri, 27 Jul 2012 10:35:07 -0500 | ||
4 | Subject: Memoize::Storable: respect 'nstore' option not respected | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Memoize(3perl) says: | ||
10 | |||
11 | tie my %cache => 'Memoize::Storable', $filename, 'nstore'; | ||
12 | memoize 'function', SCALAR_CACHE => [HASH => \%cache]; | ||
13 | |||
14 | Include the ‘nstore’ option to have the "Storable" database | ||
15 | written in ‘network order’. (See Storable for more details | ||
16 | about this.) | ||
17 | |||
18 | In fact the "nstore" option does no such thing. Option parsing looks | ||
19 | like this: | ||
20 | |||
21 | @options{@_} = (); | ||
22 | |||
23 | $self->{OPTIONS}{'nstore'} is accordingly set to undef. Later | ||
24 | Memoize::Storable checks if the option is true, and since undef is | ||
25 | not true, the "else" branch is always taken. | ||
26 | |||
27 | if ($self->{OPTIONS}{'nstore'}) { | ||
28 | Storable::nstore($self->{H}, $self->{FILENAME}); | ||
29 | } else { | ||
30 | Storable::store($self->{H}, $self->{FILENAME}); | ||
31 | } | ||
32 | |||
33 | Correcting the condition to (exists $self->{OPTIONS}{'nstore'}) fixes | ||
34 | it. | ||
35 | |||
36 | Noticed because git-svn, which uses the 'nstore' option for its | ||
37 | on-disk caches, was producing | ||
38 | |||
39 | Byte order is not compatible at ../../lib/Storable.pm | ||
40 | |||
41 | when run using a perl with a different integer size (and hence | ||
42 | byteorder). | ||
43 | |||
44 | Reported by Tim Retout (RT#77790) | ||
45 | |||
46 | Bug-Debian: http://bugs.debian.org/587650 | ||
47 | Bug: https://rt.cpan.org/Public/Bug/Display.html?id=77790 | ||
48 | Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=77790 | ||
49 | Patch-Name: fixes/memoize_storable_nstore.diff | ||
50 | Upstream-Status: Pending | ||
51 | --- | ||
52 | cpan/Memoize/Memoize/Storable.pm | 2 +- | ||
53 | cpan/Memoize/t/tie_storable.t | 24 ++++++++++++++++++++---- | ||
54 | 2 files changed, 21 insertions(+), 5 deletions(-) | ||
55 | |||
56 | diff --git a/cpan/Memoize/Memoize/Storable.pm b/cpan/Memoize/Memoize/Storable.pm | ||
57 | index 1314797..87876f2 100644 | ||
58 | --- a/cpan/Memoize/Memoize/Storable.pm | ||
59 | +++ b/cpan/Memoize/Memoize/Storable.pm | ||
60 | @@ -55,7 +55,7 @@ sub DESTROY { | ||
61 | require Carp if $Verbose; | ||
62 | my $self= shift; | ||
63 | print STDERR "Memoize::Storable::DESTROY(@_)\n" if $Verbose; | ||
64 | - if ($self->{OPTIONS}{'nstore'}) { | ||
65 | + if (exists $self->{OPTIONS}{'nstore'}) { | ||
66 | Storable::nstore($self->{H}, $self->{FILENAME}); | ||
67 | } else { | ||
68 | Storable::store($self->{H}, $self->{FILENAME}); | ||
69 | diff --git a/cpan/Memoize/t/tie_storable.t b/cpan/Memoize/t/tie_storable.t | ||
70 | index de3b8dc..a624238 100644 | ||
71 | --- a/cpan/Memoize/t/tie_storable.t | ||
72 | +++ b/cpan/Memoize/t/tie_storable.t | ||
73 | @@ -31,18 +31,34 @@ if ($@) { | ||
74 | exit 0; | ||
75 | } | ||
76 | |||
77 | -print "1..4\n"; | ||
78 | +print "1..9\n"; | ||
79 | |||
80 | $file = "storable$$"; | ||
81 | 1 while unlink $file; | ||
82 | tryout('Memoize::Storable', $file, 1); # Test 1..4 | ||
83 | 1 while unlink $file; | ||
84 | +tryout('Memoize::Storable', $file, 5, 'nstore'); # Test 5..8 | ||
85 | +assert_netorder($file, 9); # Test 9 | ||
86 | +1 while unlink $file; | ||
87 | + | ||
88 | + | ||
89 | +sub assert_netorder { | ||
90 | + my ($file, $testno) = @_; | ||
91 | + | ||
92 | + my $netorder = Storable::file_magic($file)->{'netorder'}; | ||
93 | + print ($netorder ? "ok $testno\n" : "not ok $testno\n"); | ||
94 | +} | ||
95 | |||
96 | sub tryout { | ||
97 | - my ($tiepack, $file, $testno) = @_; | ||
98 | + my ($tiepack, $file, $testno, $option) = @_; | ||
99 | |||
100 | - tie my %cache => $tiepack, $file | ||
101 | - or die $!; | ||
102 | + if (defined $option) { | ||
103 | + tie my %cache => $tiepack, $file, $option | ||
104 | + or die $!; | ||
105 | + } else { | ||
106 | + tie my %cache => $tiepack, $file | ||
107 | + or die $!; | ||
108 | + } | ||
109 | |||
110 | memoize 'c5', | ||
111 | SCALAR_CACHE => [HASH => \%cache], | ||