^C does not abort `read < /dev/zero', instead it read(2)s indefinitely,
one null byte at a time; bash and ksh93 from ports abort as expected.
Use the new timeout(1) $PROG trick to send ^C after 0.1s, but also
rely on it's -k for the final SIGKILL to stop the busy-looping process.
./th's `time-limit: 1' prints "test timed out (limit of 1 seconds)" but
leaves the process running.
-# $OpenBSD: read.t,v 1.1 2013/12/02 20:39:44 millert Exp $
+# $OpenBSD: read.t,v 1.2 2022/10/16 12:34:13 kn Exp $
#
# To test:
[abc]
---
+name: signal-aborts-endless-read
+description:
+ Check that an endless read can be interrupted.
+# XXX ^C does nothing, needs uncatchable SIGKILL to stop
+expected-fail: yes
+stdin:
+ exec timeout --preserve-status -s INT -k 0.5s -- 0.1s $PROG -c '
+ read < /dev/zero
+ '
+# 2/9 == INT/KILL
+# XXX using signal expressions like 's == 2' only works with ksh
+expected-exit: e == 128 + 2
+---