The patch/commit is not proper. The select() call will still be invoked in AIX.
It should be like this.

# diff -u src/tail.c_orig src/tail.c
--- src/tail.c_orig 2019-01-01 19:39:32 +0000
+++ src/tail.c 2019-01-15 17:58:23 +0000
@@ -30,6 +30,9 @@
#include <getopt.h>
#include <sys/types.h>
#include <signal.h>
+#ifdef _AIX
+# include <poll.h>
+#endif

#include "system.h"
#include "argmatch.h"
@@ -338,6 +341,15 @@
if (! monitor_output)
return;

+#ifdef _AIX
+ /* select on AIX was seen to give a readable event immediately. */
+ struct pollfd pfd;
+ pfd.fd = STDOUT_FILENO;
+ pfd.events = POLLERR;
+
+ if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & POLLERR))
+ raise (SIGPIPE);
+#else
struct timeval delay;
delay.tv_sec = delay.tv_usec = 0;

@@ -349,6 +361,7 @@
and implies an error condition on output like broken pipe. */
if (select (STDOUT_FILENO + 1, &rfd, NULL, NULL, &delay) == 1)
raise (SIGPIPE);
+#endif
}

Thanks
Ayappan P

Inactive hide details for Bernhard Voelker ---01/15/2019 01:25:14 PM---On 1/13/19 4:31 AM, Pádraig Brady wrote: > Thanks for teBernhard Voelker ---01/15/2019 01:25:14 PM---On 1/13/19 4:31 AM, Pádraig Brady wrote: > Thanks for testing. Pushed at:

From: Bernhard Voelker <mail@bernhard-voelker.de>
To: 33946@debbugs.gnu.org, P@draigBrady.com, ayappap2@in.ibm.com
Date: 01/15/2019 01:25 PM
Subject: bug#33946: tail -f stops abruptly in AIX when piped.
Sent by: "Bug-coreutils" <bug-coreutils-bounces+ayappap2=in.ibm.com@gnu.org>





On 1/13/19 4:31 AM, Pádraig Brady wrote:
> Thanks for testing. Pushed at:
>
https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=d5ab4cb

> -timeout 10 tail -f $mode $fastpoll out | sleep .1 || fail=1
> +(returns_ 124 timeout 10 tail -n2 -f $mode $fastpoll out && touch timed_out) |
> + sed 2q > out2
> +test -e timed_out && fail=1
> +compare exp out2 || fail=1

I see the 'timed_out' file when running the test on openSUSE's build service
for Linux x86_64, and can reproduce when running that in the local 'osc' build
environment (chroot-based).

I'm not sure what's the problem though, but could this be related to
how we fixed 'tests/misc/seq-epipe.sh' a while ago in v8.25-42-g383e4b2ce?

BTW: in the 2nd iteration, the test doesn't delete 'timed_out',
so will always set fail=1 if the 1st one failed.

Have a nice day,
Berny