tail -F 'dir/file' is now monitored even when 'dir' is replaced.
[bug introduced with inotify support added in coreutils-7.5]
- tail -f with --pid=PID will now process all inotify events.
+ tail -f with --pid=PID now processes all inotify events.
Previously events may have been ignored completely upon PID death,
or ignored until future events on the monitored files.
[bug introduced with inotify support added in coreutils-7.5]
mv --verbose now distinguishes rename and copy operations.
- tail -f will now exit immediately if the output is piped
+ tail -f now exits immediately if the output is piped
and the reader of the pipe terminates.
+ tail -f no longer erroneously warns about being ineffective
+ when following a single tty, as the simple blocking loop used
+ is effective in this case.
+
* Noteworthy changes in release 8.27 (2017-03-08) [stable]
if (found_hyphen && follow_mode == Follow_name)
die (EXIT_FAILURE, 0, _("cannot follow %s by name"), quoteaf ("-"));
- /* When following forever, warn if any file is '-'.
+ /* When following forever, and not using simple blocking, warn if
+ any file is '-' as the stats() used to check for input are ineffective.
This is only a warning, since tail's output (before a failing seek,
and that from any non-stdin files) might still be useful. */
- if (forever && found_hyphen && isatty (STDIN_FILENO))
- error (0, 0, _("warning: following standard input"
- " indefinitely is ineffective"));
+ if (forever && found_hyphen)
+ {
+ struct stat in_stat;
+ bool blocking_stdin;
+ blocking_stdin = (pid == 0 && follow_mode == Follow_descriptor
+ && n_files == 1 && ! fstat (STDIN_FILENO, &in_stat)
+ && ! S_ISREG (in_stat.st_mode));
+
+ if (! blocking_stdin && isatty (STDIN_FILENO))
+ error (0, 0, _("warning: following standard input"
+ " indefinitely is ineffective"));
+ }
}
/* Don't read anything if we'll never output anything. */
#!/bin/sh
-# tail -f - would fail with the initial inotify implementation
+# Test tail -f -
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ tail
+#################
+# tail -f - would fail with the initial inotify implementation
+
check_tail_output()
{
local delay="$1"
done
+#################
# Before coreutils-8.26 this would induce an UMR under UBSAN
returns_ 1 timeout 10 tail -f - <&- 2>errt || fail=1
cat <<\EOF >exp || framework_failure_
compare exp err || fail=1
+#################
+# Before coreutils-8.28 this would erroneously issue a warning
+if tty -s </dev/tty && test -t 0; then
+ for input in '' '-' '/dev/tty'; do
+ returns_ 124 timeout 0.1 tail -f $input 2>err || fail=1
+ compare /dev/null err || fail=1
+ done
+
+ tail -f - /dev/null </dev/tty 2> out & pid=$!
+ # Wait up to 12.7s for output to appear:
+ tail_re='ineffective' retry_delay_ check_tail_output .1 7 ||
+ { cat out; fail=1; }
+ cleanup_
+fi
+
Exit $fail