GNU bug report logs -
#49078
dejagnu-1.6.3 test failure
Previous Next
Full log
View this message in rfc822 format
(I've just sent this to the mailing list, but so it's in the bug report
as well...)
Jacob Bachmeyer <jcb62281 <at> gmail.com> writes:
> Expect is incorrectly treating a line exactly 64 bytes long as EOF.
I've just run into this as well when packaging 1.6.3 -- for me, it
happens on Linux 5.10 but not on Linux 4.19, where expect's read(0, buf,
4096) call reads 65 bytes including the newline. So I guess it's become
visible as a result of some change in Linux tty behaviour...
After a bit of debugging, the cause seems to be that expect uses
Tcl_GetsObj to read from stdin, and treats a -1 return value as an
error. However, Tcl_GetsObj can also return -1 to indicate that input
was blocked, i.e. it didn't manage to read a complete line -- expect
didn't handle this case.
This patch seems to fix the problem:
--- expect5.45.4/exp_main_sub.c 2018-02-04 10:43:58.000000000 +0000
+++ expect5.45.4/exp_main_sub.c 2021-10-23 00:39:09.375404444 +0100
@@ -326,7 +326,9 @@
if (code != EXP_EOF) {
inChannel = expStdinoutGet()->channel;
- code = Tcl_GetsObj(inChannel, commandPtr);
+ do {
+ code = Tcl_GetsObj(inChannel, commandPtr);
+ } while (code < 0 && Tcl_InputBlocked(inChannel));
#ifdef SIMPLE_EVENT
if (code == -1 && errno == EINTR) {
if (Tcl_AsyncReady()) {
(expect experts may have a better solution, of course!)
Thanks,
--
Adam Sampson <ats <at> offog.org> <http://offog.org/>
This bug report was last modified 3 years and 297 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.