1
0
mirror of https://git.savannah.gnu.org/git/coreutils.git synced 2025-09-11 12:50:47 +03:00
Files
coreutils/tests/tail/pid-pipe.sh
Pádraig Brady 177fcec66d tail: honor --pid with fifos
* src/tail.c (tail_file): Open files with O_NONBLOCK
if we might need async processing.
(pipe_bytes): Ignore EAGAIN read() errors.
(pipe_lines): Likewise.
* tests/tail/pid-pipe.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.
Reported by Berhard Voelker.
2025-01-08 12:11:43 +00:00

37 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# Ensure that "tail --pid=PID fifo" exits responsively
# Copyright (C) 2025 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ tail
mkfifo_or_skip_ fifo
# Terminate any background process
cleanup_() { kill $pid 2>/dev/null && wait $pid; }
# Speedup the non inotify case
fastpoll='-s.1 --max-unchanged-stats=1'
sleep 1 & pid=$!
returns_ 124 timeout 10 tail -f $fastpoll --pid=$! fifo && fail=1
cleanup_
Exit $fail