Hello, Trying a bit on Linux with buffer sizes, this really is an issue between tcl and expect. It happens to work on Linux only by luck because Linux never returns more than 4095 bytes on ptys. As you described earlier, what happens is:
- expect has a 6001 bytes buffer - tcl will read() by 4096 bunches on Linux, the tcl read() will always get a 4095 bytes short read, and thus provide the bytes to expect. on Hurd, the tcl read() will get a 4096 full read, and thus tcl will try to fill more, and eventually get an EIO error because the writer is away. I've rebuilt tcl and expect with the attached patches, to lower the buffer size and thus avoid the short reads on Linux. With the attached test and e files, I get this: read(6, "/media/erich/home/thomas/tmp/gcc"..., 1024) = 1024 read(6, "oating constant\r\n/media/erich/ho"..., 1024) = 1024 read(6, "valid suffix \"rul\" on floating c"..., 1024) = 1024 write(1, "/media/erich/home/thomas/tmp/gcc"..., 1024) = 1024 write(1, "oating constant\r\n/media/erich/ho"..., 1024) = 1024 write(1, "valid suffix \"rul\" on floating c"..., 953) = 953 write(4, "\0", 1) = 1 ... read(6, "p/pr33466.c:31:19: error: invali"..., 1024) = 1024 read(6, "/gcc/testsuite/gcc.dg/cpp/pr3346"..., 1024) = 1024 read(6, "ch/home/thomas/tmp/gcc/trunk/gcc"..., 1024) = 1024 write(1, "onstant\r\n/media/erich/home/thoma"..., 1024) = 1024 write(1, "ffix \"lku\" on floating constant\r"..., 1024) = 1024 write(1, "66.c:46:18: error: invalid suffi"..., 953) = 953 write(4, "\0", 1) = 1 ... read(6, " constant\r\n/media/erich/home/tho"..., 1024) = 1024 read(6, "ix \"fdd\" on floating constant\r\n/"..., 1024) = 1024 read(6, 0xdd6568, 1024) = -1 EIO (Input/output error) and the output is truncated to only the 2 first series of writes! I guess the fix should be in tcl, to store the error, and provide it to expect only after having returned the remaining bytes. Samuel
diff --exclude .svn --exclude .git --exclude CVS --exclude .hg -ur tcl8.6-8.6.2+dfsg/generic/tclIO.h ../tcl8.6-8.6.2+dfsg/generic/tclIO.h --- tcl8.6-8.6.2+dfsg/generic/tclIO.h 2014-07-31 21:17:23.000000000 +0200 +++ ../tcl8.6-8.6.2+dfsg/generic/tclIO.h 2015-01-18 21:39:23.758270391 +0100 @@ -64,7 +64,7 @@ * The following defines the *default* buffer size for channels. */ -#define CHANNELBUFFER_DEFAULT_SIZE (1024 * 4) +#define CHANNELBUFFER_DEFAULT_SIZE (1024) /* * The following structure describes the information saved from a call to
diff --exclude .svn --exclude .git --exclude CVS --exclude .hg -ur expect-5.45/exp_clib.c ../expect-5.45/exp_clib.c --- expect-5.45/exp_clib.c 2015-01-18 21:32:59.000000000 +0100 +++ ../expect-5.45/exp_clib.c 2015-01-18 21:31:48.873800506 +0100 @@ -1697,7 +1697,7 @@ } -#define EXP_MATCH_MAX 2000 +#define EXP_MATCH_MAX 1000 /* public */ char *exp_buffer = 0; char *exp_buffer_end = 0; diff --exclude .svn --exclude .git --exclude CVS --exclude .hg -ur expect-5.45/exp_command.c ../expect-5.45/exp_command.c --- expect-5.45/exp_command.c 2015-01-18 21:32:59.000000000 +0100 +++ ../expect-5.45/exp_command.c 2015-01-18 21:31:46.597882444 +0100 @@ -172,7 +172,7 @@ Tcl_Interp *interp; char *fmt; va_list args; - char buffer[2000]; + char buffer[1000]; interp = TCL_VARARGS_START(Tcl_Interp *,arg1,args); fmt = va_arg(args,char *); diff --exclude .svn --exclude .git --exclude CVS --exclude .hg -ur expect-5.45/expect.c ../expect-5.45/expect.c --- expect-5.45/expect.c 2015-01-18 21:32:59.000000000 +0100 +++ ../expect-5.45/expect.c 2015-01-18 21:31:51.653700425 +0100 @@ -44,7 +44,7 @@ #include "retoglob.c" /* RE 2 GLOB translator C variant */ /* initial length of strings that we can guarantee patterns can match */ -int exp_default_match_max = 2000; +int exp_default_match_max = 1000; #define INIT_EXPECT_TIMEOUT_LIT "10" /* seconds */ #define INIT_EXPECT_TIMEOUT 10 /* seconds */ int exp_default_parity = TRUE; diff --exclude .svn --exclude .git --exclude CVS --exclude .hg -ur expect-5.45/exp_log.c ../expect-5.45/exp_log.c --- expect-5.45/exp_log.c 2015-01-18 21:32:59.000000000 +0100 +++ ../expect-5.45/exp_log.c 2015-01-18 21:31:55.105576154 +0100 @@ -44,7 +44,7 @@ * create a reasonably large buffer for the bulk of the output routines * that are not too large */ -static char bigbuf[2000]; +static char bigbuf[1000]; static void expDiagWriteCharsUni _ANSI_ARGS_((Tcl_UniChar *str,int len)); @@ -303,7 +303,7 @@ { char *fmt; va_list args; - char bigbuf[2000]; + char bigbuf[1000]; int len, rc; fmt = TCL_VARARGS_START(char *,arg1,args);
/media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:8:18: error: invalid suffix "rh" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:9:18: error: invalid suffix "rl" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:10:19: error: invalid suffix "rll" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:11:18: error: invalid suffix "kh" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:12:18: error: invalid suffix "kl" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:13:19: error: invalid suffix "kll" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:14:18: error: invalid suffix "ru" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:15:19: error: invalid suffix "urh" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:16:19: error: invalid suffix "hur" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:17:19: error: invalid suffix "hru" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:18:19: error: invalid suffix "ruh" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:19:19: error: invalid suffix "rhu" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:20:19: error: invalid suffix "url" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:21:19: error: invalid suffix "lur" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:22:19: error: invalid suffix "lru" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:23:19: error: invalid suffix "rul" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:24:19: error: invalid suffix "rlu" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:25:20: error: invalid suffix "urll" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:26:20: error: invalid suffix "llur" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:27:20: error: invalid suffix "llru" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:28:20: error: invalid suffix "rull" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:29:20: error: invalid suffix "rllu" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:30:18: error: invalid suffix "ku" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:31:19: error: invalid suffix "ukh" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:32:19: error: invalid suffix "huk" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:33:19: error: invalid suffix "hku" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:34:19: error: invalid suffix "kuh" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:35:19: error: invalid suffix "khu" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:36:19: error: invalid suffix "ukl" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:37:19: error: invalid suffix "luk" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:38:19: error: invalid suffix "lku" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:39:19: error: invalid suffix "kul" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:40:19: error: invalid suffix "klu" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:41:20: error: invalid suffix "ukll" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:42:20: error: invalid suffix "lluk" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:43:20: error: invalid suffix "llku" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:44:20: error: invalid suffix "kull" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:45:20: error: invalid suffix "kllu" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:46:18: error: invalid suffix "ld" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:47:18: error: invalid suffix "fd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:48:18: error: invalid suffix "dk" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:49:18: error: invalid suffix "dr" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:50:19: error: invalid suffix "ddw" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:51:19: error: invalid suffix "ddq" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:52:19: error: invalid suffix "ddl" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:53:19: error: invalid suffix "ddf" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:54:19: error: invalid suffix "ddd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:55:18: error: invalid suffix "dw" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:56:18: error: invalid suffix "dq" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:57:18: error: invalid suffix "wd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:58:18: error: invalid suffix "qd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:59:19: error: invalid suffix "wdd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:60:19: error: invalid suffix "qdd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:61:19: error: invalid suffix "ldd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:62:19: error: invalid suffix "fdd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:63:19: error: invalid suffix "ddi" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:64:19: error: invalid suffix "idd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:64:19: error: invalid suffix "idd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:64:19: error: invalid suffix "idd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:64:19: error: invalid suffix "idd" on floating constant /media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:64:19: error: invalid suffix "idd" on floating constant aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/media/erich/home/thomas/tmp/gcc/trunk/gcc/testsuite/gcc.dg/cpp/pr33466.c:64:19: error: invalid suffix "idd" on floating constant
#!/usr/bin/expect -f stty cooked spawn sh -c "cat < /tmp/e" interact