summaryrefslogtreecommitdiff
path: root/tests/tail-2
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tail-2')
-rwxr-xr-xtests/tail-2/F-vs-missing.sh2
-rwxr-xr-xtests/tail-2/F-vs-rename.sh2
-rwxr-xr-xtests/tail-2/append-only.sh2
-rwxr-xr-xtests/tail-2/assert-2.sh2
-rwxr-xr-xtests/tail-2/assert.sh2
-rwxr-xr-xtests/tail-2/big-4gb.sh2
-rwxr-xr-xtests/tail-2/flush-initial.sh2
-rwxr-xr-xtests/tail-2/follow-name.sh2
-rwxr-xr-xtests/tail-2/follow-stdin.sh4
-rwxr-xr-xtests/tail-2/infloop-1.sh5
-rwxr-xr-xtests/tail-2/inotify-hash-abuse.sh2
-rwxr-xr-xtests/tail-2/inotify-hash-abuse2.sh2
-rwxr-xr-xtests/tail-2/inotify-race.sh18
-rwxr-xr-xtests/tail-2/inotify-rotate.sh4
-rwxr-xr-xtests/tail-2/pid.sh2
-rwxr-xr-xtests/tail-2/pipe-f.sh2
-rwxr-xr-xtests/tail-2/pipe-f2.sh2
-rwxr-xr-xtests/tail-2/proc-ksyms.sh2
-rwxr-xr-xtests/tail-2/retry.sh114
-rwxr-xr-xtests/tail-2/start-middle.sh2
-rwxr-xr-xtests/tail-2/symlink.sh78
-rwxr-xr-xtests/tail-2/tail-n0f.sh7
-rwxr-xr-xtests/tail-2/wait.sh6
23 files changed, 234 insertions, 32 deletions
diff --git a/tests/tail-2/F-vs-missing.sh b/tests/tail-2/F-vs-missing.sh
index 0f744042..d47b3022 100755
--- a/tests/tail-2/F-vs-missing.sh
+++ b/tests/tail-2/F-vs-missing.sh
@@ -3,7 +3,7 @@
# Before coreutils-8.6, tail -F missing/file would not
# notice any subsequent availability of the missing/file.
-# Copyright (C) 2010-2013 Free Software Foundation, Inc.
+# Copyright (C) 2010-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/F-vs-rename.sh b/tests/tail-2/F-vs-rename.sh
index 4f3ad5eb..3e31ec8c 100755
--- a/tests/tail-2/F-vs-rename.sh
+++ b/tests/tail-2/F-vs-rename.sh
@@ -3,7 +3,7 @@
# Before coreutils-8.3, tail -F a b would stop tracking additions to b
# after "mv a b".
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/append-only.sh b/tests/tail-2/append-only.sh
index 93d0b323..7414da3e 100755
--- a/tests/tail-2/append-only.sh
+++ b/tests/tail-2/append-only.sh
@@ -2,7 +2,7 @@
# Ensure that tail -f works on an append-only file
# Requires root access to do chattr +a, as well as an ext[23] or xfs file system
-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+# Copyright (C) 2006-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/assert-2.sh b/tests/tail-2/assert-2.sh
index 13cb3e02..930e422a 100755
--- a/tests/tail-2/assert-2.sh
+++ b/tests/tail-2/assert-2.sh
@@ -3,7 +3,7 @@
# Due to a race condition in the test, the 'assert' script would get
# the UMR on Solaris only some of the time, and not at all on Linux/GNU.
-# Copyright (C) 2000-2013 Free Software Foundation, Inc.
+# Copyright (C) 2000-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/assert.sh b/tests/tail-2/assert.sh
index ee7cec8c..35a10da2 100755
--- a/tests/tail-2/assert.sh
+++ b/tests/tail-2/assert.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Test for assertion failure in "test".
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/big-4gb.sh b/tests/tail-2/big-4gb.sh
index 4e7463c6..cfd867b7 100755
--- a/tests/tail-2/big-4gb.sh
+++ b/tests/tail-2/big-4gb.sh
@@ -2,7 +2,7 @@
# Demonstrate a bug in 'tail -cN' when operating on files of size 4G and larger
# Fixed in coreutils-4.5.2.
-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/flush-initial.sh b/tests/tail-2/flush-initial.sh
index c9f7f4e7..fd14eae9 100755
--- a/tests/tail-2/flush-initial.sh
+++ b/tests/tail-2/flush-initial.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# inotify-based tail -f didn't flush its initial output before blocking
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/follow-name.sh b/tests/tail-2/follow-name.sh
index ba480fee..f70baec3 100755
--- a/tests/tail-2/follow-name.sh
+++ b/tests/tail-2/follow-name.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# ensure that --follow=name does not imply --retry
-# Copyright (C) 2011-2013 Free Software Foundation, Inc.
+# Copyright (C) 2011-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/follow-stdin.sh b/tests/tail-2/follow-stdin.sh
index b2ccba35..1769ee2c 100755
--- a/tests/tail-2/follow-stdin.sh
+++ b/tests/tail-2/follow-stdin.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# tail -f - would fail with the initial inotify implementation
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ timeout 1 tail -f < in > out 2> err
test $? = 124 || fail=1
# Ensure there was no error output.
-test -s err && fail=1
+compare /dev/null err || fail=1
# Ensure there was
compare exp out || fail=1
diff --git a/tests/tail-2/infloop-1.sh b/tests/tail-2/infloop-1.sh
index a4afb675..37d081f3 100755
--- a/tests/tail-2/infloop-1.sh
+++ b/tests/tail-2/infloop-1.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# This test would fail with tail from pre-1.22i textutils.
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,8 @@ print_ver_ tail
yes > t &
yes_pid=$!
while :; do
- test -s t && break
+ test -s t \
+ && break
sleep .1
done
tail -n 1 t &
diff --git a/tests/tail-2/inotify-hash-abuse.sh b/tests/tail-2/inotify-hash-abuse.sh
index b9c7f108..6492049d 100755
--- a/tests/tail-2/inotify-hash-abuse.sh
+++ b/tests/tail-2/inotify-hash-abuse.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Exercise an abort-inducing flaw in inotify-enabled tail -F.
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/inotify-hash-abuse2.sh b/tests/tail-2/inotify-hash-abuse2.sh
index 7dbefdd3..6018448f 100755
--- a/tests/tail-2/inotify-hash-abuse2.sh
+++ b/tests/tail-2/inotify-hash-abuse2.sh
@@ -2,7 +2,7 @@
# Exercise an abort-inducing flaw in inotify-enabled tail -F.
# Like inotify-hash-abuse, but without a hard-coded "9".
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/inotify-race.sh b/tests/tail-2/inotify-race.sh
index cc0f61b3..c25f354a 100755
--- a/tests/tail-2/inotify-race.sh
+++ b/tests/tail-2/inotify-race.sh
@@ -5,7 +5,7 @@
# indefinitely if no *other* data is appended, but it would be printed as
# soon as any additional appended data is detected.
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,26 +37,30 @@ case $(cat gdb.out) in
*) skip_ "can't run gdb";;
esac
+break_src="$abs_top_builddir/src/tail.c"
+break_line=$(grep -n ^tail_forever_inotify "$break_src") || framework_failure_
+break_line=$(echo "$break_line" | cut -d: -f1) || framework_failure_
+
# See if gdb works and
-# tail_forever_inotify is compiled and not inlined
+# tail_forever_inotify is compiled and run
timeout 10s gdb -nx --batch-silent \
- --eval-command='break tail_forever_inotify' \
+ --eval-command="break $break_line" \
--eval-command='run -f file' \
--eval-command='quit' \
- tail < /dev/null > gdb.out 2>&1
+ tail < /dev/null > gdb.out 2>&1 || skip_ 'breakpoint not hit'
# FIXME: The above is seen to _intermittently_ fail with:
# warning: .dynamic section for "/lib/libc.so.6" is not at the expected address
# warning: difference appears to be caused by prelink, adjusting expectations
-test -s gdb.out && { cat gdb.out; skip_ "can't set breakpoints in tail"; }
+compare /dev/null gdb.out || skip_ "can't set breakpoints in tail"
# Run "tail -f file", stopping to append a line just before
# inotify initialization, and then continue. Before the fix,
# that just-appended line would never be output.
timeout 10s gdb -nx --batch-silent \
- --eval-command='break tail_forever_inotify' \
+ --eval-command="break $break_line" \
--eval-command='run -f file >> tail.out' \
- --eval-command="shell echo never-seen-with-tail-7.5 >> file" \
+ --eval-command='shell echo never-seen-with-tail-7.5 >> file' \
--eval-command='continue' \
--eval-command='quit' \
tail < /dev/null > /dev/null 2>&1 &
diff --git a/tests/tail-2/inotify-rotate.sh b/tests/tail-2/inotify-rotate.sh
index 4a16202d..1c942cc3 100755
--- a/tests/tail-2/inotify-rotate.sh
+++ b/tests/tail-2/inotify-rotate.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# ensure that tail -F handles rotation
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ for i in $(seq 50); do
# Normally less than a second is required here, but with heavy load
# and a lot of disk activity, even 20 seconds is insufficient, which
# leads to this timeout killing tail before the "ok" is written below.
- :>k && :>x || framework_failure_ failed to initialize files
+ >k && >x || framework_failure_ failed to initialize files
timeout 40 tail -F k > out 2>&1 &
pid=$!
sleep .1
diff --git a/tests/tail-2/pid.sh b/tests/tail-2/pid.sh
index 19e6a18b..ef440818 100755
--- a/tests/tail-2/pid.sh
+++ b/tests/tail-2/pid.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Test the --pid option of tail.
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 2003-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/pipe-f.sh b/tests/tail-2/pipe-f.sh
index e0cf3c6d..eaa928fb 100755
--- a/tests/tail-2/pipe-f.sh
+++ b/tests/tail-2/pipe-f.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# ensure that :|tail -f doesn't hang, per POSIX
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/pipe-f2.sh b/tests/tail-2/pipe-f2.sh
index 63091e39..13ccd0b3 100755
--- a/tests/tail-2/pipe-f2.sh
+++ b/tests/tail-2/pipe-f2.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Ensure that "tail -f fifo" tails indefinitely.
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/proc-ksyms.sh b/tests/tail-2/proc-ksyms.sh
index 243bb9b9..3f799649 100755
--- a/tests/tail-2/proc-ksyms.sh
+++ b/tests/tail-2/proc-ksyms.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Prior to textutils-2.0.17, 'tail /proc/ksyms' would segfault on Linux.
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/retry.sh b/tests/tail-2/retry.sh
new file mode 100755
index 00000000..dbe66a4e
--- /dev/null
+++ b/tests/tail-2/retry.sh
@@ -0,0 +1,114 @@
+#!/bin/sh
+# Exercise tail's behavior regarding missing files with/without --retry.
+
+# Copyright (C) 2013-2014 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ tail
+
+# Function to check the expected line count in 'out'.
+# Called via retry_delay_(). Sleep some time - see retry_delay_() - if the
+# line count is still smaller than expected.
+wait4lines_ ()
+{
+ local delay=$1
+ local elc=$2 # Expected line count.
+ [ "$( wc -l < out )" -ge "$elc" ] || { sleep $delay; return 1; }
+}
+
+# === Test:
+# Retry without --follow results in a warning.
+touch file
+tail --retry file > out 2>&1 || fail=1
+[ $( wc -l < out ) = 1 ] || fail=1
+grep -F 'tail: warning: --retry ignored' out || fail=1
+
+# === Test:
+# The same with a missing file: expect error message and exit 1.
+tail --retry missing > out 2>&1 && fail=1
+[ $( wc -l < out ) = 2 ] || fail=1
+grep -F 'tail: warning: --retry ignored' out || fail=1
+
+# === Test:
+# Ensure that "tail --retry --follow=name" waits for the file to appear.
+# Clear 'out' so that we can check its contents without races
+>out || framework_failure_
+timeout 10 tail -s.1 --follow=name --retry missing >out 2>&1 & pid=$!
+retry_delay_ wait4lines_ .1 6 1 || fail=1 # Wait for "cannot open" error.
+echo "X" > missing || fail=1
+retry_delay_ wait4lines_ .1 6 3 || fail=1 # Wait for the expected output.
+kill $pid
+wait $pid
+# Expect 3 lines in the output file.
+[ $( wc -l < out ) = 3 ] || { fail=1; cat out; }
+grep -F 'cannot open' out || { fail=1; cat out; }
+grep -F 'has appeared' out || { fail=1; cat out; }
+grep '^X$' out || { fail=1; cat out; }
+rm -f missing out || framework_failure_
+
+# === Test:
+# Ensure that "tail --retry --follow=descriptor" waits for the file to appear.
+# tail-8.21 failed at this (since the implementation of the inotify support).
+timeout 10 tail -s.1 --follow=descriptor --retry missing >out 2>&1 & pid=$!
+retry_delay_ wait4lines_ .1 6 2 || fail=1 # Wait for "cannot open" error.
+echo "X" > missing || fail=1
+retry_delay_ wait4lines_ .1 6 4 || fail=1 # Wait for the expected output.
+kill $pid
+wait $pid
+# Expect 4 lines in the output file.
+[ $( wc -l < out ) = 4 ] || { fail=1; cat out; }
+grep -F 'retry only effective for the initial open' out \
+ || { fail=1; cat out; }
+grep -F 'cannot open' out || { fail=1; cat out; }
+grep -F 'has appeared' out || { fail=1; cat out; }
+grep '^X$' out || { fail=1; cat out; }
+rm -f missing out || framework_failure_
+
+# === Test:
+# Ensure that tail --follow=descriptor --retry exits when the file appears
+# untailable. Expect exit status 1.
+timeout 10 tail -s.1 --follow=descriptor --retry missing >out 2>&1 & pid=$!
+retry_delay_ wait4lines_ .1 6 2 || fail=1 # Wait for "cannot open" error.
+mkdir missing || fail=1 # Create untailable 'missing'.
+retry_delay_ wait4lines_ .1 6 4 || fail=1 # Wait for the expected output.
+wait $pid
+rc=$?
+[ $( wc -l < out ) = 4 ] || { fail=1; cat out; }
+grep -F 'retry only effective for the initial open' out \
+ || { fail=1; cat out; }
+grep -F 'cannot open' out || { fail=1; cat out; }
+grep -F 'replaced with an untailable file' out || { fail=1; cat out; }
+grep -F 'no files remaining' out || { fail=1; cat out; }
+[ $rc = 1 ] || { fail=1; cat out; }
+rm -fd missing out || framework_failure_
+
+# === Test:
+# Ensure that --follow=descriptor (without --retry) does *not wait* for the
+# file to appear. Expect 2 lines in the output file ("cannot open" +
+# "no files remaining") and exit status 1.
+tail --follow=descriptor missing >out 2>&1 && fail=1
+[ $( wc -l < out ) = 2 ] || { fail=1; cat out; }
+grep -F 'cannot open' out || { fail=1; cat out; }
+grep -F 'no files remaining' out || { fail=1; cat out; }
+
+# === Test:
+# Likewise for --follow=name (without --retry).
+tail --follow=name missing >out 2>&1 && fail=1
+[ $( wc -l < out ) = 2 ] || { fail=1; cat out; }
+grep -F 'cannot open' out || { fail=1; cat out; }
+grep -F 'no files remaining' out || { fail=1; cat out; }
+
+Exit $fail
diff --git a/tests/tail-2/start-middle.sh b/tests/tail-2/start-middle.sh
index 67d5b1a9..dbf9bae8 100755
--- a/tests/tail-2/start-middle.sh
+++ b/tests/tail-2/start-middle.sh
@@ -2,7 +2,7 @@
# Verify that tail works even when it's reading from a file
# that is not at its beginning. Based on a report from John Roll.
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/tail-2/symlink.sh b/tests/tail-2/symlink.sh
new file mode 100755
index 00000000..b21f9e15
--- /dev/null
+++ b/tests/tail-2/symlink.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+# Ensure tail tracks symlinks properly.
+
+# Copyright (C) 2013-2014 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ tail
+
+# Function to check the expected line count in 'out'.
+# Called via retry_delay_(). Sleep some time - see retry_delay_() - if the
+# line count is still smaller than expected.
+wait4lines_ ()
+{
+ local delay=$1
+ local elc=$2 # Expected line count.
+ [ "$( wc -l < out )" -ge "$elc" ] || { sleep $delay; return 1; }
+}
+
+# Ensure changing targets of cli specified symlinks are handled.
+# Prior to v8.22, inotify would fail to recognize changes in the targets.
+# Clear 'out' so that we can check its contents without races.
+>out || framework_failure_
+ln -nsf target symlink || framework_failure_
+timeout 10 tail -s.1 -F symlink >out 2>&1 & pid=$!
+retry_delay_ wait4lines_ .1 6 1 || fail=1 # Wait for "cannot open..."
+echo "X" > target || fail=1
+retry_delay_ wait4lines_ .1 6 3 || fail=1 # Wait for the expected output.
+kill $pid
+wait $pid
+# Expect 3 lines in the output file.
+[ $( wc -l < out ) = 3 ] || { fail=1; cat out; }
+grep -F 'cannot open' out || { fail=1; cat out; }
+grep -F 'has appeared' out || { fail=1; cat out; }
+grep '^X$' out || { fail=1; cat out; }
+rm -f target out || framework_failure_
+
+# Ensure we correctly handle the source symlink itself changing.
+# I.E. that we don't operate solely on the targets.
+# Clear 'out' so that we can check its contents without races.
+>out || framework_failure_
+echo "X1" > target1 || framework_failure_
+ln -nsf target1 symlink || framework_failure_
+timeout 10 tail -s.1 -F symlink >out 2>&1 & pid=$!
+retry_delay_ wait4lines_ .1 6 1 || fail=1 # Wait for the expected output.
+ln -nsf target2 symlink || framework_failure_
+retry_delay_ wait4lines_ .1 6 2 || fail=1 # Wait for "become inaccess..."
+echo "X2" > target2 || fail=1
+retry_delay_ wait4lines_ .1 6 4 || fail=1 # Wait for the expected output.
+kill $pid
+wait $pid
+# Expect 4 lines in the output file.
+[ $( wc -l < out ) = 4 ] || { fail=1; cat out; }
+grep -F 'become inacce' out || { fail=1; cat out; }
+grep -F 'has appeared' out || { fail=1; cat out; }
+grep '^X1$' out || { fail=1; cat out; }
+grep '^X2$' out || { fail=1; cat out; }
+rm -f target1 target2 out || framework_failure_
+
+# Note other symlink edge cases are currently just diagnosed
+# rather than being handled. I.E. if you specify a missing item,
+# or existing file that later change to a symlink, if inotify
+# is in use, you'll get a diagnostic saying that link will
+# no longer be tailed.
+
+Exit $fail
diff --git a/tests/tail-2/tail-n0f.sh b/tests/tail-2/tail-n0f.sh
index a8d37597..1d020ac9 100755
--- a/tests/tail-2/tail-n0f.sh
+++ b/tests/tail-2/tail-n0f.sh
@@ -2,7 +2,7 @@
# Make sure that 'tail -n0 -f' and 'tail -c0 -f' sleep
# rather than doing what amounted to a busy-wait.
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 2003-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,6 +29,11 @@ require_proc_pid_status_
touch empty || framework_failure_
echo anything > nonempty || framework_failure_
+# First verify that -[nc]0 without -f, exit without reading
+touch unreadable || framework_failure_
+chmod 0 unreadable || framework_failure_
+tail -c0 unreadable || fail=1
+tail -n0 unreadable || fail=1
for inotify in ---disable-inotify ''; do
for file in empty nonempty; do
diff --git a/tests/tail-2/wait.sh b/tests/tail-2/wait.sh
index 529b9459..3dec55c0 100755
--- a/tests/tail-2/wait.sh
+++ b/tests/tail-2/wait.sh
@@ -2,7 +2,7 @@
# Make sure that 'tail -f' returns immediately if a file doesn't exist
# while 'tail -F' waits for it to appear.
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 2003-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,8 +51,8 @@ for inotify in ---disable-inotify ''; do
grep -Ev 'inotify (resources exhausted|cannot be used)' tail.err > x
mv x tail.err
- test -s tail.err && fail=1
- :>tail.err
+ compare /dev/null tail.err || fail=1
+ >tail.err
tail_F()
{