[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fix races in tail tests and in tail itself
From: |
Pádraig Brady |
Subject: |
fix races in tail tests and in tail itself |
Date: |
Mon, 11 May 2015 14:53:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
Following further fixes to the tail tests,
I noticed races in tail itself, that were
identified by the improved tests and aided
with nanosleeps temporarily added to tail.c
In summary the tail fixes are:
tail: fix inotify startup races
With --follow=descriptor, if the tailed file was replaced before
the inotify watch was added, then any subsequent changes were ignored.
Similarly in --follow=name mode, all changes to a new name were
effectively ignored if that name was created after the original open()
but before the inotify_add_watch().
tail: consistently output all data for truncated files
Generally if logs are truncated, they're truncated to 0 length,
so output all existing data when our heuristic determines truncation.
Note with inotify, truncate() and write() are often determined
independently and so all data would be written if that was the case.
The 5 patch set is attached.
cheers,
Pádraig.
tail-races.patch
Description: Text Data