haikuports / haikuports

Software ports for the Haiku operating system.
MIT License
408 stars 305 forks source link

Reading end of file in "expect" doesn't work #8910

Open pulkomandy opened 1 year ago

pulkomandy commented 1 year ago

Here is a simple expect script (you can run the expect command and then type this):

spawn echo
expect eof

This is supposed to start the "echo" command and make sure it quits immediately (by reading its stdout and finding an end of file).

On Linux, the second command returns immediately. On Haiku, it doesn't, and instead you have to wait for a 10 seconds timeout.

I ran this with strace to see what's going on, the timeout is from a mutex_switch_lock call in Haiku waiting on a pthread condition variable. The linux equivalent seems to be a futex call FUTEX_WAKE_PRIVATE.

I don't know if this is related to recent changes in this area (I started trying to use expect just this week). So if someone can test this on an older system it would be quite helpful?

pulkomandy commented 1 year ago

Waddlesplash confirmed that this was already the case in beta 4 and so not caused by a recent regression. Thanks!

pulkomandy commented 1 year ago

I have also opened a ticket on expect side in case they can help: https://sourceforge.net/p/expect/support-requests/8/