diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-05-05 22:11:24 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-05-11 23:03:32 +0100 |
commit | cf06a872e74b45588c2e64903f7fc99cf2aafe27 (patch) | |
tree | 56ab22a4de51b29f1f49f2e02f506be416b06244 /tests/pr/t_notab | |
parent | 9069f4ec850364e778c51bfa6f1ab761be67caec (diff) | |
download | coreutils-cf06a872e74b45588c2e64903f7fc99cf2aafe27.tar.xz |
tail: fix inotify startup races
The previous fixes to races in the various tail tests,
identified actual races in the tail inotify implementation.
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().
* src/tail.c (tail_forever_inotify): Fix 3 cases.
1. With -f, don't stop tailing when file removed before watch.
2. With -f, watch right file when file replaced before watch.
3. With -F, inspect correct file when replaced before watch.
Existing tests identify these when tail compiled with TAIL_TEST_SLEEP.
* tests/tail-2/inotify-rotate-resources.sh:
This test also identifies the issue with --follow=name
when TAIL_TEST_SLEEP is used. Adjust so the test is immune
to such races, and also fail quicker on remote file systems.
* tests/tail-2/inotify-race2.sh: A new test using GDB,
based on inotify-race.sh, which tests the -F race
without needed recompilation with sleeps.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug.
Diffstat (limited to 'tests/pr/t_notab')
0 files changed, 0 insertions, 0 deletions