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