* 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.
# 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