]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tail now ignores the -f option if POSIXLY_CORRECT is set,
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Sep 2006 17:19:51 +0000 (17:19 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Sep 2006 17:19:51 +0000 (17:19 +0000)
no file operand is given, and standard input is any FIFO.

ChangeLog
NEWS
doc/ChangeLog
doc/coreutils.texi
src/tail.c

index 66bfa4dde0237cd7c192a8f1408ed3ea5fe3232f..73283c6c529b19d803bce3558c6d973b44928f92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-09-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * 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.
+       * src/tail.c (main): Likewise.
+
 2006-09-08  Jim Meyering  <jim@meyering.net>
 
        mv and "cp -r" no longer fail when invoked with two arguments
diff --git a/NEWS b/NEWS
index ffe7fcb053952b261e529dc2e568955035cd4514..73cdea3e933e8cbdd43d1e9576210964d8d4d95b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,10 @@ GNU coreutils NEWS                                    -*- outline -*-
   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.
index 3f863b08b34c94195be9696e67162a8c1ff9d8d1..f2d23be3b52dc9416bbf05da5249ad37611472b3 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * coreutils.texi (tail invocation): Ignore -f when standard input
+       is a FIFO, too.
+
 2006-09-02  Paul Eggert  <eggert@cs.ucla.edu>
 
        * coreutils.texi (Treating / specially): --preserve-root is
index 08de387fe8224f7bdccf71c74a5e8ca3e7e2e686..51493874c05ec227890160e58a90d0a2404bb8be 100644 (file)
@@ -2578,7 +2578,7 @@ with the long form of the option, not with @option{-f}.
 
 @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
index 082ddfc5217374b1f1cc28d340e506f6bebe1e29..7d8f421e6458204230485f41c415ab383198b008 100644 (file)
@@ -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;
        }
     }