2 # Make sure that `tail -f' returns immediately if a file doesn't exist
3 # while `tail -F' waits for it to appear.
5 # Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if test "$VERBOSE" = yes; then
27 touch here || framework_failure
28 touch k || framework_failure
29 { touch unreadable && chmod a-r unreadable; } || framework_failure
32 for inotify in ---disable-inotify ''; do
33 timeout 1 tail -s0.1 -f $inotify not_here
34 test $? = 124 && fail=1
36 if test ! -r unreadable; then # can't test this when root
37 timeout 1 tail -s0.1 -f $inotify unreadable
38 test $? = 124 && fail=1
41 timeout 1 tail -s0.1 -f $inotify here 2>tail.err
42 test $? = 124 || fail=1
44 # `tail -F' must wait in any case.
46 timeout 1 tail -s0.1 -F $inotify here 2>>tail.err
47 test $? = 124 || fail=1
49 if test ! -r unreadable; then # can't test this when root
50 timeout 1 tail -s0.1 -F $inotify unreadable
51 test $? = 124 || fail=1
54 timeout 1 tail -s0.1 -F $inotify not_here
55 test $? = 124 || fail=1
58 test -s tail.err && fail=1
62 tail -s.1 --max-unchanged-stats=2 -F $inotify k > tail.out &
73 test -s tail.out && fail=1