From 1555bcec6aae06df01a52d3656e8ca35e7dea938 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Tue, 14 Jan 2025 21:14:50 +0000 Subject: [PATCH] tests: tail: avoid failure on Solaris 11 * 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 b7de1e9384..75392df23e 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.3