File: 0001-future-io-syswrite-test-unclog-the-pipe-harder.patch

package info (click to toggle)
libio-async-perl 0.804-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,184 kB
  • sloc: perl: 13,884; makefile: 8
file content (39 lines) | stat: -rw-r--r-- 1,299 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From cc3da5f2cd9e137f95f42988129f741dc634d56c Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Fri, 11 Feb 2022 22:42:09 +0200
Subject: [PATCH] future-io syswrite test: unclog the pipe harder

Reading out 4 kB from a full pipe is not enough to unblock
it on all systems.

On Linux, the pipe size is by default 16 * page size, and
at least the Debian (and apparently Alpine too) ppc64le port
has a page size of 64 kB instead of the more usual 4 kB.

Bug: https://rt.cpan.org/Ticket/Display.html?id=140021
Bug-Debian: https://bugs.debian.org/1002541
---
 t/70future-io.t | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/t/70future-io.t b/t/70future-io.t
index ee9cf36..fd565bf 100644
--- a/t/70future-io.t
+++ b/t/70future-io.t
@@ -56,7 +56,12 @@ testing_loop( IO::Async::Loop->new_builtin );
 
    my $f = Future::IO->syswrite( $wr, "ABCD" );
 
-   $rd->sysread( my $buf, 4096 );
+   my $n = 0;
+   # read as long as the pipe still blocks
+   $rd->sysread( my $buf, 4096 ) and $n++ while !$wr->syswrite( "X" x 4096)
+    and ($! == Errno::EAGAIN or $! == Errno::EWOULDBLOCK);
+   # now we know how much we need to read out to unblock
+   $rd->sysread( $buf, 4096 ) for 1..$n;
 
    is( ( wait_for_future $f )->get, 4, 'Future::IO->syswrite' );
 
-- 
2.30.2