diff options
author | Pádraig Brady <P@draigBrady.com> | 2016-11-08 17:34:44 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2016-11-08 23:19:08 +0000 |
commit | 2a809125299261db9db9b97e93b5885223c6e9d3 (patch) | |
tree | 5940d90ba24dfa28c8715a99bea76f57193e6415 /tests/tail-2 | |
parent | 23066be1b655fd81542761161c4f7ef37dc0813b (diff) | |
download | coreutils-2a809125299261db9db9b97e93b5885223c6e9d3.tar.xz |
tail: terminate when following pipes and untailable non pipes
* src/tail.c (ignore_pipe_or_fifo): Mark the descriptor as -1
for pipes so that any_live_files() detects correctly that
the entry is no longer live.
* tests/tail-2/pipe-f.sh: Add a test case.
* NEWS: Mention the fix.
Fixes http://bugs.gnu.org/24903 which was detected
using Symbolic Execution techniques developed in
the course of the SYMBIOSYS research project at
COMSYS, RWTH Aachen University.
Diffstat (limited to 'tests/tail-2')
-rwxr-xr-x | tests/tail-2/pipe-f.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/tail-2/pipe-f.sh b/tests/tail-2/pipe-f.sh index 7abb7d6fe..82364dacc 100755 --- a/tests/tail-2/pipe-f.sh +++ b/tests/tail-2/pipe-f.sh @@ -19,9 +19,18 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ tail +echo oo > exp || framework_failure_ echo foo | timeout 10 tail -f -c3 > out || fail=1 -echo oo > exp || fail=1 +compare exp out || fail=1 + +cat <<\EOF > exp +==> standard input <== +ar +==> missing <== +EOF +mkdir missing || framework_failure_ +echo bar | returns_ 1 timeout 10 tail -f -c3 - missing > out || fail=1 compare exp out || fail=1 Exit $fail |