]> git.ipfire.org Git - thirdparty/coreutils.git/commit
tail: fix unlikely races with >=2 --pids
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 1 Aug 2025 20:46:33 +0000 (13:46 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 4 Aug 2025 02:48:06 +0000 (19:48 -0700)
commit93805484c55ac5da2304eecb0e69356f40a89552
tree4ca47975eea791a9260a90aa772d291c3aca47d2
parent15c67b79af7df75c28af1e462619722c73676184
tail: fix unlikely races with >=2 --pids

Also, fix commentary to talk about “nonexistent” rather than
“dead” processes, since the code looks for the former not the
latter and the difference matters for zombies.
* src/tail.c (some_writers_exist): Rename from writers_are_dead,
negate the sense, don’t have a special and counterintuitive case
for !nbpids, remove PIDs found not to exist, and avoid some
though not all unlikely races when kernels reuse PIDs.
(tail_forever): Optimize via blocking I/O even if --pid was used,
so long as all the writers no longer exist.
(tail_forever, tail_forever_inotify): Simplify the writers_dead
logic; there is no need to have a local var to track this, since
we can use pids and nbpids now.
(parse_options): Also free and clear pids if !forever.
NEWS
doc/coreutils.texi
src/tail.c