tail: ignore -f for piped-stdin, as POSIX requires
authorJim Meyering <meyering@redhat.com>
Mon, 7 Sep 2009 20:10:10 +0000 (22:10 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 7 Sep 2009 21:19:56 +0000 (23:19 +0200)
commitaf6436559c2954d7f35b7fec29dfcbaa4ebdc03b
tree4c5d53442d729d663c15809899bd5c03bdf13b6d
parentfd9750b0ffb691d2ad97551eada5c2802df3c805
tail: ignore -f for piped-stdin, as POSIX requires

* src/tail.c (main): Tailing a pipe "forever" is not useful,
and POSIX specifies that tail ignore the -f when there is no
file argument and stdin is a FIFO or pipe.  So we do that.
In addition, GNU tail excludes "-" arguments from the list of files
to tail forever, when the associated file descriptor is connected
to a FIFO or pipe.  Before this change, ":|tail -f" would hang.
Reported by Ren Yang and Ulrich Drepper.
* tests/tail-2/pipe-f: Test for this.
* tests/tail-2/pipe-f2: Ensure tail doesn't exit early for a fifo.
* tests/Makefile.am (TESTS): Add these tests.
* NEWS (POSIX conformance): Mention it.
NEWS
THANKS
src/tail.c
tests/Makefile.am
tests/tail-2/pipe-f [new file with mode: 0755]
tests/tail-2/pipe-f2 [new file with mode: 0755]