GNU bug report logs - #33946
tail -f stops abruptly in AIX when piped.

Previous Next

Package: coreutils;

Reported by: "Ayappan P2" <ayappap2 <at> in.ibm.com>

Date: Tue, 1 Jan 2019 17:06:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #37 received at 33946 <at> debbugs.gnu.org (full text, mbox):

From: "Ayappan P2" <ayappap2 <at> in.ibm.com>
To: P <at> draigBrady.com
Cc: 33946 <at> debbugs.gnu.org, Bernhard Voelker <mail <at> bernhard-voelker.de>,
 Bug-coreutils <bug-coreutils-bounces+ayappap2=in.ibm.com <at> gnu.org>
Subject: Re: bug#33946: tail -f stops abruptly in AIX when piped.
Date: Tue, 15 Jan 2019 18:12:43 +0530
[Message part 1 (text/plain, inline)]
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



From:	Bernhard Voelker <mail <at> bernhard-voelker.de>
To:	33946 <at> debbugs.gnu.org, P <at> draigBrady.com, ayappap2 <at> 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 <at> 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






[Message part 2 (text/html, inline)]
[graycol.gif (image/gif, inline)]

This bug report was last modified 6 years and 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.