Pádraig Brady wrote: ... > Actually taking a closer look this morning shows > a race in tail_forever_inotify(). > Hopefully the attached addresses both that and the redundant delay. > > cheers, > Pádraig. >>From d0a8f4b88196e8808300ec5b4f4dd424fc0d2073 Mon Sep 17 00:00:00 2001 > From: =?utf-8?q?P=C3=A1draig=20Brady?= <[email protected]> > Date: Thu, 1 Oct 2009 08:36:25 +0100 > Subject: [PATCH] tail: avoid a race where we could miss new data with --pid > > * src/tail.c (tail_forever, tail_forever_inotify): Close a race in > tail_forever_inotify where new data written after the file check by > a now dead process, but before the pid check is not output. We use > the POSIX guarantee that read() and write() are serialized wrt each > other even in separate processes, to assume full file consistency > after exit() and so poll for new data _after_ the writer has exited. > This also allows us to not redundantly _wait_ for new data if the > process is dead. > * tests/tail-2/pid: Remove the now partially invalid sub second sleep > check as we now don't unconditionally wait, and replace it with a check > for the redundant sleep. Also clarify some of the existing comments. > * NEWS: Mention the fix. > --- > NEWS | 6 ++++++ > gnulib | 2 +-
Thanks! I'll take a look shortly. Please omit that change to gnulib.
