To add to this, the fact that the SVN switched ot a 2.7 release (in r134) but then there never was a formal release of that (the repository has no tags, and there is no released source archive) is also a little confusing. Should we assume r134 is the 2.7.0 release?
The previous strace output was missing spawned threads, here is a more complete one: [ 3166] open(0xffffffff, "/dev/tty", O_RDWR, 0x0) = 0x3 (30 us) [ 3166] ioctl(0x3, TCGETA, 0x1c322f83560, 0x0) = 0x0 No error (16 us) [ 3166] ioctl(0x3, TIOCGWINSZ, 0x1c322f83170, 0xd40ccc888c) = 0x0 No error (14 us) [ 3166] ioctl(0x0, TCGETA, 0x7f60df9cf360, 0x20) = 0x0 No error (14 us) [ 3166] ioctl(0x1, TCGETA, 0x7f60df9cf360, 0x20) = 0x0 No error (13 us) [ 3166] ioctl(0x0, TCGETA, 0x7f60df9cf340, 0x20) = 0x0...
I have now fixed that bug: closing the pty was not unblocking poll()/select() waiting for read events on the other side of it. However, that didn't help: expect is still not noticing when the pty is closed by the child exiting.
I have made some testing of PTY behavior in Haiku and I think I found a bug: https://dev.haiku-os.org/ticket/18486 However, I am not sure where in expect or in tcl this would come into play, as I didn't find an use of select or poll (probably I just missed it because I don't know where to look).
The PTY system is configured to use openpty and should behave similarly to the BSDs, but of course, there could be bugs. It seems to be working except for the end of file detection. For example if I do: spawn echo hi expect hi This is working fine. Yes, we have strace. Here is the trace on Haiku: [ 3199] open(0xffffffff, "/dev/tty", O_RDWR, 0x0) = 0x3 (31 us) [ 3199] ioctl(0x3, TCGETA, 0x1491b524560, 0x0) = 0x0 No error (14 us) [ 3199] ioctl(0x3, TIOCGWINSZ, 0x1491b524170, 0x1d907acf8bc) = 0x0 No...
Expect on Haiku fails to wait for end of file
Yes, and after checking the current upstream source, I can confirm the Haiku changes are already there: https://sourceforge.net/p/sdcc/code/HEAD/tree/trunk/sdcc/support/sdbinutils/bfd/config.bfd So, this part is already done and I will just have to wait for the next SDCC release.
The patch was merged in late 2021: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d85e70a35bffa755fd3e9f4ccc6bf6c64953e85d I think all versions after binutils 2.38 or 2.39 should include it.