ast
ast copied to clipboard
Timed reads on Cygwin timeout immediately
After several weeks of effort I've gotten the unit test failures on Cygwin down to just signal.sh. The failure of that unit test is because timed reads (e.g., read -t5 -u9 x
) timeout immediately. What is weird is the underlying read()
syscall returns -1 with errno == 70. But errno 70 is ECOMM
which makes no sense in this context. Nonetheless, both a DPRINTF()
added here and the output from running the test via strace
show that to be true:
https://github.com/att/ast/blob/6b0910a6ccf2f0323d1d87906617fe7f0e510afd/src/lib/libast/sfio/sfrd.c#L256-L258
Also weird is that the timedout()
function is never called:
https://github.com/att/ast/blob/6b0910a6ccf2f0323d1d87906617fe7f0e510afd/src/cmd/ksh93/bltins/read.c#L418-L422
And that function should be called as a result of the timer alarm firing; even if the timer expires too early. I've confirmed that on all other platforms it is called when a timeout occurs. For the moment I'm just going to bypass the problematic tests on Cygwin.
Also, the signal.sh unit test emits this error:
sigtst0[62]: fifo9: cannot create [Device or resource busy]
Which appears to be due to a race involving the empty_fifos
function called at the end of that module. Which might deserve its own issue but I'm just going to document it here. If and when someone fixes the issue in the original problem statement they should verify whether this issue still exists and, if so, open a new issue.
The recent change I made to better handle timeouts of expect
based unit tests is affected by this bug. Specifically, that improvement uses read -t
which acts as if the timeout is always zero on Cygwin. Thus immediately killing the expect
based unit test. Thus, all expect
based unit tests fail on Cygwin. /me grinds my teeth
On the one hand I'm tempted to just say "fsck it -- drop support for Cygwin." But I am loath to do so since it is otherwise useful to ensure we can build on hostile platforms that are not faithful clones of Linux or BSD platforms.