bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"tail -f <fifo" now ignores the -f if POSIXLY_CORRECT


From: Paul Eggert
Subject: "tail -f <fifo" now ignores the -f if POSIXLY_CORRECT
Date: Fri, 08 Sep 2006 10:22:18 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

I installed this in response to yesterday's decision by the Open Group
committee.  This affects only the POSIXLY_CORRECT behavior.

2006-09-08  Paul Eggert  <address@hidden>

        * NEWS: tail now ignores the -f option if POSIXLY_CORRECT is set,
        no file operand is given, and standard input is any FIFO.
        This is in response to Open Group XCU ERN 114.
        * doc/coreutils.texi (tail invocation): Likewise.
        * src/tail.c (main): Likewise.

--- NEWS        8 Sep 2006 17:08:53 -0000       1.417
+++ NEWS        8 Sep 2006 17:18:48 -0000
@@ -8,6 +8,10 @@ GNU coreutils NEWS                      
   now fails without removing anything.  Likewise for any file name with
   a final `./' or `../' component.
 
+  tail now ignores the -f option if POSIXLY_CORRECT is set, no file
+  operand is given, and standard input is any FIFO; formerly it did
+  this only for pipes.
+
 ** Infrastructure changes
 
   Coreutils now uses gnulib via the gnulib-tool script.
--- doc/coreutils.texi  3 Sep 2006 02:56:35 -0000       1.348
+++ doc/coreutils.texi  8 Sep 2006 17:18:51 -0000
@@ -2578,7 +2578,7 @@ with the long form of the option, not wi
 
 @vindex POSIXLY_CORRECT
 If @env{POSIXLY_CORRECT} is set, the @option{-f} option is ignored if
-no @var{file} operand is specified and standard input is a pipe.
+no @var{file} operand is specified and standard input is a FIFO or a pipe.
 
 @item -F
 @opindex -F
--- src/tail.c  29 Aug 2006 20:50:22 -0000      1.251
+++ src/tail.c  8 Sep 2006 17:18:51 -0000
@@ -1640,10 +1640,15 @@ main (int argc, char **argv)
 
       if (forever && getenv ("POSIXLY_CORRECT"))
        {
-         int is_a_pipe = isapipe (STDIN_FILENO);
-         if (is_a_pipe < 0)
+         struct stat st;
+         int is_a_fifo_or_pipe =
+           (fstat (STDIN_FILENO, &st) != 0 ? -1
+            : S_ISFIFO (st.st_mode) ? 1
+            : HAVE_FIFO_PIPES == 1 ? 0
+            : isapipe (STDIN_FILENO));
+         if (is_a_fifo_or_pipe < 0)
            error (EXIT_FAILURE, errno, _("standard input"));
-         if (is_a_pipe)
+         if (is_a_fifo_or_pipe)
            forever = false;
        }
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]