Skip to content
Tcl Source Code Artifact [30c846a9ac]
Login

Artifact [30c846a9ac]

Artifact 30c846a9acf01b7667d401ab5c15aca6bfdd0acb:

Ticket change [30c846a9ac] - Ticket [30c5d37cfa0028c9|30c5d37cfa] <i>Expect eof occurring before end of output from spawned process</i> status still Open with 3 other changes by tld on 2013-08-03 08:49:22.
D 2013-08-03T08:49:22.603
J comment I've\snever\slogged\sa\sticket\shere.\s\sApologies\sif\sI\sget\ssomething\swrong.\r\n\r\nWe\sinitially\snoticed\sthis\sbehavior\sin\sexpect\sscripts\sthat\swere\sgetting\sdata\sfrom\scommands\srun\son\sremote\ssystems\svia\sssh,\sbut\sI've\sbeen\sable\sto\sduplicate\sthe\sbehavior\sin\svery\ssimple\sexpect\sscripts\sthat\ssimply\sspawn\sa\sprocess\sthat\suses\scat\sto\soutput\sa\sfile.\r\n\r\nThe\sbehavior\sis\ssomewhat\sunpredictable\sbut\smy\stests\sreproduce\sit\smuch\smore\soften\sthen\snot.\s\sWhat\shappens\sis\sthat\swithin\san\sexpect\sblock,\sonly\sin\scases\swhere\sthe\sexpect\sblock\sdoes\spattern\smatching\sof\sany\skind,\san\seof\scan\soccur\sbefore\sall\sthe\sdata\sis\soutput\sby\sthe\sspawned\scommand,\sthus\struncating\sthe\soutput.\r\n\r\nI\scannot\sreproduce\sthis\son\san\solder\sCentOS\s5\ssystem\srunning\stcl-8.4.13\s(and\sexpect-5.43.0-8).\s\sI\scan\showever\sreproduce\sit\son\sany\ssystem\sI've\stried\susing\stcl\s8.5,\sincluding\sCentOS\s6\s(tcl-8.5.7-6.el6.x86_64,\sexpect-5.44.1.15-4.el6.x86_64)\sand\son\san\sx86\sGentoo\ssystem\s(dev-lang/tcl-8.5.13-r1\sand\sdev-tcltk/expect-5.44.1.15).\r\n\r\nAs\smentioned\sabove,\sthis\sonly\soccurs\sif\sthe\sexpect\sblock\shas\spatterns\sin\saddition\sto\sthe\seof.\s\sI've\spasted\sa\stest\sscript\sbelow\sthat\sspawns\s"cat\s./in.txt".\s\sI've\sbeen\stesting\swith\sthat\susing:\r\n\r\nexpect\stest.expect\s>\sout.txt\r\n\r\n...and\sthen...\r\n\r\ndiff\s-w\sin.txt\sout.txt\r\n\r\n...which\swill\sshow\sthat\sthe\soutput\swas\struncated.\s\sI\scan\sreproduce\sthis\son\sfiles\sas\ssmall\sas\s1000\slines\sand\saround\s40-50k,\swith\sno\stext\sthat\swould\smatch\sany\sof\sthe\spatters,\sand\sit\sappears\sthat\sit's\smore\slikely\sto\soccur\sif\smatch_max\sis\sreduced.\r\n\r\nHere\sis\sthe\stest\sscript.\s\sNote\sthat\ssome\sthe\soriginal\spatterns\shave\sbeen\sleft\sin,\sbut\sdon't\sactually\sneed\sto\smatch\sany\stext:\r\n\r\nset\stimeout\s30\r\n\r\nproc\sexitspawnstat\sargs\s{\r\n\s\s\scatch\swait\sresult\r\n\s\s\sset\srtn\s[lindex\s$result\s2]\r\n\s\s\sif\s{\s!$rtn\s}\s{\r\n\s\s\s\s\s\sset\srtn\s[lindex\s$result\s3]\r\n\s\s\s}\r\n\s\s\sexit\s$rtn\r\n}\r\n\r\nlog_user\s1\r\nspawn\s-noecho\scat\s./in.txt\r\nexpect\s{\r\n\s\s\seof\s{\r\n\s\s\s\s\s\sexitspawnstat\r\n\s\s\s}\r\n\s\s\stimeout\s{\r\n\s\s\s\s\s\slog_user\s1\r\n\s\s\s\s\s\ssend_user\s"Timeout.\\n"\r\n\s\s\s\s\s\sexit\s253\r\n\s\s\s}\r\n\s\s\s-nocase\s-re\s"password:"\s{\s\r\n\s\s\s\s\s\sexp_continue\r\n\s\s\s}\r\n\s\s\s"(yes/no)?\s"\s{\s\r\n\s\s\s\s\s\sexp_continue\r\n\s\s\s}\r\n\s\s\s-nocase\s-re\s"Enter\spassphrase"\s{\r\n\s\s\s\s\s\sexp_continue\r\n\s\s\s}\r\n\s\s\s"testing-sudo-passwd:"\s{\r\n\s\s\s\s\s\sexp_continue\r\n\s\s\s}\r\n}
J login tld
J mimetype text/plain
K 30c5d37cfa0028c9ef83fa9efc490f4bc28b64ff
U tld
Z ee2aa0bc6360c6ccf7cb7664b324935b