* tests/tail/tail-c.sh: On Solaris 11, tail -c 4096 /dev/urandom, will induce an lseek(,-4096,SEEK_END) which returns -4096 without setting errno, and a subsequent read() then gives EINVAL. Since tailing the end of a psuedo device is an edge case, we just verify that we don't spin reading the device forever. --- tests/tail/tail-c.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tests/tail/tail-c.sh b/tests/tail/tail-c.sh index b7de1e938..75392df23 100755 --- a/tests/tail/tail-c.sh +++ b/tests/tail/tail-c.sh @@ -42,7 +42,14 @@ compare exp out || fail=1 # Any part of /dev/urandom, if it exists, should be valid for tail -c. if test -r /dev/urandom; then - timeout --verbose 1 tail -c 4096 /dev/urandom >/dev/null || fail=1 + # Or at least it should not read it forever + timeout --verbose 1 tail -c 4096 /dev/urandom >/dev/null 2>err + case $? in + 0) ;; + # Solaris 11 allows negative seek but then gives EINVAL on read + 1) grep 'Invalid argument' err || fail=1;; + *) fail=1;; + esac fi Exit $fail -- 2.47.1