summaryrefslogtreecommitdiff
path: root/tests/tail-2/inotify-race2.sh
AgeCommit message (Collapse)Author
2015-05-19tests: fix non POSIX constructs causing failures with dashPádraig Brady
* tests/cp/no-ctx.sh: Scope of `var=val func` is inconsistent across shells, so avoid that construct with functions. * tests/df/no-mtab-status.sh: Likewise. * tests/tail-2/inotify-race.sh: `read` needs an argument. * tests/tail-2/inotify-race2.sh: Likewise.
2015-05-11tail: fix inotify startup racesPádraig Brady
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.