On AIX 7.2, I see a test failure: FAIL: test-pipe-filter-gi1.sh =============================
test-pipe-filter-gi1: write to tr subprocess failed: Resource temporarily unavailable FAIL test-pipe-filter-gi1.sh (exit status: 1) What happens is: While writing to a pipe, through a file descriptor in non-blocking mode, after select() reported that the file descriptor is writeable, write() of a block of 29 KB of data fails with errno = EAGAIN. This is persistent; it does not go away by retrying even hundreds of times. Other OSes would have done a partial write and returned a positive return code. (Especially as 1. the file descriptor refers to a pipe, not a regular file, and 2. it is in non-blocking mode.) AIX, however, forces the program to do the throttling by itself: Limiting the write to 4 KB works around the issue. 2021-01-05 Bruno Haible <[email protected]> pipe-filter-gi: Fix test failure on AIX 7.2. * lib/pipe-filter-aux.h (SSIZE_MAX) [AIX]: Set to 4096. diff --git a/lib/pipe-filter-aux.h b/lib/pipe-filter-aux.h index 294a27e..2977260 100644 --- a/lib/pipe-filter-aux.h +++ b/lib/pipe-filter-aux.h @@ -26,6 +26,15 @@ _GL_INLINE_HEADER_BEGIN #ifndef SSIZE_MAX # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif +#ifdef _AIX +/* On AIX, despite having select() and despite having put the file descriptor + in non-blocking mode, it can happen that select() reports that fd[1] is + writable but writing a large amount of data to fd[1] then fails with errno + EAGAIN. Seen with test-pipe-filter-gi1 on AIX 7.2, with data sizes of + 29 KB. So, limit the size of data passed to the write() call to 4 KB. */ +# undef SSIZE_MAX +# define SSIZE_MAX 4096 +#endif /* We use a child process, and communicate through a bidirectional pipe. To avoid deadlocks, let the child process decide when it wants to read
