diff options
Diffstat (limited to 'meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/autodie-flock.diff')
-rw-r--r-- | meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/autodie-flock.diff | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/autodie-flock.diff b/meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/autodie-flock.diff new file mode 100644 index 0000000000..f8908ac872 --- /dev/null +++ b/meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/autodie-flock.diff | |||
@@ -0,0 +1,98 @@ | |||
1 | From: Niko Tyni <ntyni@debian.org> | ||
2 | Subject: Allow for flock returning EAGAIN instead of EWOULDBLOCK on linux/parisc | ||
3 | Bug-Debian: http://bugs.debian.org/543731 | ||
4 | Origin: upstream, http://github.com/pfenwick/autodie/commit/037738e11a6097734b0e1dabdd77b92e5fe35219 | ||
5 | |||
6 | |||
7 | --- | ||
8 | cpan/autodie/lib/Fatal.pm | 14 +++++++++++++- | ||
9 | cpan/autodie/t/flock.t | 12 ++++++++++-- | ||
10 | 2 files changed, 23 insertions(+), 3 deletions(-) | ||
11 | |||
12 | diff --git a/cpan/autodie/lib/Fatal.pm b/cpan/autodie/lib/Fatal.pm | ||
13 | old mode 100644 | ||
14 | new mode 100755 | ||
15 | index 18e71ed..c17a257 | ||
16 | --- a/cpan/autodie/lib/Fatal.pm | ||
17 | +++ b/cpan/autodie/lib/Fatal.pm | ||
18 | @@ -5,6 +5,7 @@ use Carp; | ||
19 | use strict; | ||
20 | use warnings; | ||
21 | use Tie::RefHash; # To cache subroutine refs | ||
22 | +use Config; | ||
23 | |||
24 | use constant PERL510 => ( $] >= 5.010 ); | ||
25 | |||
26 | @@ -52,6 +53,10 @@ our %_EWOULDBLOCK = ( | ||
27 | MSWin32 => 33, | ||
28 | ); | ||
29 | |||
30 | +# the linux parisc port has separate EAGAIN and EWOULDBLOCK, | ||
31 | +# and the kernel returns EAGAIN | ||
32 | +my $try_EAGAIN = ($^O eq 'linux' and $Config{archname} =~ /hppa|parisc/) ? 1 : 0; | ||
33 | + | ||
34 | # We have some tags that can be passed in for use with import. | ||
35 | # These are all assumed to be CORE:: | ||
36 | |||
37 | @@ -720,6 +725,11 @@ sub _one_invocation { | ||
38 | my $EWOULDBLOCK = eval { POSIX::EWOULDBLOCK(); } | ||
39 | || $_EWOULDBLOCK{$^O} | ||
40 | || _autocroak("Internal error - can't overload flock - EWOULDBLOCK not defined on this system."); | ||
41 | + my $EAGAIN = $EWOULDBLOCK; | ||
42 | + if ($try_EAGAIN) { | ||
43 | + $EAGAIN = eval { POSIX::EAGAIN(); } | ||
44 | + || _autocroak("Internal error - can't overload flock - EAGAIN not defined on this system."); | ||
45 | + } | ||
46 | |||
47 | require Fcntl; # For Fcntl::LOCK_NB | ||
48 | |||
49 | @@ -735,7 +745,9 @@ sub _one_invocation { | ||
50 | # If we failed, but we're using LOCK_NB and | ||
51 | # returned EWOULDBLOCK, it's not a real error. | ||
52 | |||
53 | - if (\$_[1] & Fcntl::LOCK_NB() and \$! == $EWOULDBLOCK ) { | ||
54 | + if (\$_[1] & Fcntl::LOCK_NB() and | ||
55 | + (\$! == $EWOULDBLOCK or | ||
56 | + ($try_EAGAIN and \$! == $EAGAIN ))) { | ||
57 | return \$retval; | ||
58 | } | ||
59 | |||
60 | diff --git a/cpan/autodie/t/flock.t b/cpan/autodie/t/flock.t | ||
61 | index a7550ba..6421a56 100755 | ||
62 | --- a/cpan/autodie/t/flock.t | ||
63 | +++ b/cpan/autodie/t/flock.t | ||
64 | @@ -2,7 +2,8 @@ | ||
65 | use strict; | ||
66 | use Test::More; | ||
67 | use Fcntl qw(:flock); | ||
68 | -use POSIX qw(EWOULDBLOCK); | ||
69 | +use POSIX qw(EWOULDBLOCK EAGAIN); | ||
70 | +use Config; | ||
71 | |||
72 | require Fatal; | ||
73 | |||
74 | @@ -10,6 +11,9 @@ my $EWOULDBLOCK = eval { EWOULDBLOCK() } | ||
75 | || $Fatal::_EWOULDBLOCK{$^O} | ||
76 | || plan skip_all => "EWOULDBLOCK not defined on this system"; | ||
77 | |||
78 | +my $try_EAGAIN = ($^O eq 'linux' and $Config{archname} =~ /hppa|parisc/) ? 1 : 0; | ||
79 | +my $EAGAIN = eval { EAGAIN() }; | ||
80 | + | ||
81 | my ($self_fh, $self_fh2); | ||
82 | |||
83 | eval { | ||
84 | @@ -55,7 +59,11 @@ eval { | ||
85 | $return = flock($self_fh2, LOCK_EX | LOCK_NB); | ||
86 | }; | ||
87 | |||
88 | -is($!+0, $EWOULDBLOCK, "Double-flocking should be EWOULDBLOCK"); | ||
89 | +if (!$try_EAGAIN) { | ||
90 | + is($!+0, $EWOULDBLOCK, "Double-flocking should be EWOULDBLOCK"); | ||
91 | +} else { | ||
92 | + ok($!+0 == $EWOULDBLOCK || $!+0 == $EAGAIN, "Double-flocking should be EWOULDBLOCK or EAGAIN"); | ||
93 | +} | ||
94 | ok(!$return, "flocking a file twice should fail"); | ||
95 | is($@, "", "Non-blocking flock should not fail on EWOULDBLOCK"); | ||
96 | |||
97 | -- | ||
98 | tg: (c823880..) fixes/autodie-flock (depends on: upstream) | ||