diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2013-04-20 16:33:06 +0200 |
---|---|---|
committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2013-04-20 16:33:06 +0200 |
commit | d461bfd2743547360793acd2118d4c08ad7b84a8 (patch) | |
tree | 6e81dc004be45e9dea0c7b469b7d98c9f0277950 /init.cfg | |
parent | 1dd8a33169b69716c4a4b92dbe1bd99336d92b23 (diff) | |
download | coreutils-d461bfd2743547360793acd2118d4c08ad7b84a8.tar.xz |
tail: let -f --retry wait for inaccessible files
The --retry option is indeed useful for both following modes
by name and by file descriptor. The difference is that in the
latter case, it is effective only during the initial open.
As a regression of the implementation of the inotify support,
tail -f --retry would immediately exit if the given file is
inaccessible.
* src/tail.c (usage): Change the description of the --retry option:
remove the note that this option would mainly be useful when
following by name.
(main): Change diagnosing dubios uses of --retry option:
when the --retry option is used without following, then issue
a warning that this option is ignored; when it is used together
with --follow=descriptor, then issue a warning that it is only
effective for the initial open.
Disable inotify also in the case when the initial open in tail_file()
failed (which is the actual bug fix).
* init.cfg (retry_delay_): Pass excess arguments to the test function.
* tests/tail-2/retry.sh: Add new tests.
* tests/local.mk (all_tests): Mention it.
* doc/coreutils.texi (tail invocation): Enhance the documentation
of the --retry option. Clarify the difference in tail's behavior
regarding the --retry option when combined with the following modes
name versus descriptor.
* NEWS (Bug fixes): Mention the fix.
Reported by Noel Morrison in:
http://lists.gnu.org/archive/html/coreutils/2013-04/msg00003.html
Diffstat (limited to 'init.cfg')
-rw-r--r-- | init.cfg | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -556,11 +556,13 @@ working_umask_or_skip_() # Note ensure you do _not_ quote the parameter to GNU sleep in # your function, as it may contain separate values that sleep # needs to accumulate. +# Further function arguments will be forwarded to the test function. retry_delay_() { local test_func=$1 local init_delay=$2 local max_n_tries=$3 + shift 3 || return 1 local attempt=1 local num_sleeps=$attempt @@ -568,7 +570,7 @@ retry_delay_() while test $attempt -le $max_n_tries; do local delay=$($AWK -v n=$num_sleeps -v s="$init_delay" \ 'BEGIN { print s * n }') - "$test_func" "$delay" && { time_fail=0; break; } || time_fail=1 + "$test_func" "$delay" "$@" && { time_fail=0; break; } || time_fail=1 attempt=$(expr $attempt + 1) num_sleeps=$(expr $num_sleeps '*' 2) done |