.
D 2021-02-27T04:08:26.930
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment I'm\sbuilding\san\sextension\sto\sa\slarge\sand\srather\sopaque\sLinux\spackage\r\n(About\swhich\sI\swon't\ssay\smore).\s\sOne\sof\sthe\sthings\sI\sknew\sfrom\sthe\r\ndocumentation,\sbut\swhich\sI\shad\snot\sthought\sabout\sis\sthat\sthe\spackage\r\nuses\stimers\sand\sSIGALRM\shandling\sinternally\sto\sdo\sits\shouse\skeeping\r\nand\smaintain\sits\sstate.\s\sI\ssaw\sthe\swarning\sto\snot\suse\sSIGALRM\sin\r\nany\scalling\sprogram,\sbut\ssince\sI\swasn't\sdoing\sthat,\sand\swas\spretty\r\nsure\sTcl\swasn't\sdoing\sthat,\sI\swasn't\sworried.\r\n\r\nAnd\sin\sfact,\sthings\swork\spretty\swell\sas\slong\sas\sI\sam\srunning\smy\r\ntests\sfrom\sscripts.\s\sI\snoticed\showever,\sthat\sif\sI\shad\sthe\spackage\r\nloaded\sin\san\sinteractive\sTclsh\sso\sI\scould\stype\sthings\sat\sit,\sTclsh\r\nwould\soften\sunexpectedly\s&\ssilently\sexit.\sI\sfinally\sfigured\sout\r\nthis\smust\sbe\swhenever\sa\sSIGLARM\sfires\sand\sthe\spackage\scalls\sits\r\nhandler\sfunction.\r\n\r\nLooking\sat\sthe\scode\sin\stclUnixChan.c\swhere\sthe\sTclsh\sterminal\sread\r\nloop\sreads\sare\sdone,\sI\ssee\sthat\sEINTR\sis\snot\shandled,\seven\sthough\r\nit\sis\shandled\sfor\spipes\sand\ssockets\selsewhere.\r\n\r\nIf\sI\smake\sthe\sfollowing\schange,\sbased\son\sthe\scode\sused\sfor\spipes\r\nand\ssockets,\s\sand\scompile\sa\snew\sTclsh,\sit\sworks\sfine.\s\sThis\sseems\r\nlike\sa\sbug\sto\sme\s--\sis\sthere\ssome\sreason\sfor\snot\shandling\sEINTR\r\nhere?\r\n\r\n\r\n%\sdiff\s-c\stclUnixChan.c.bak\stclUnixChan.c\r\n***\stclUnixChan.c.bak\s\s\sFri\sFeb\s12\s13:59:13\s2021\r\n---\stclUnixChan.c\s\s\s\s\s\s\sFri\sFeb\s12\s13:59:13\s2021\r\n***************\r\n***\s253,259\s****\r\n\s\s\s\s\s\s\s*\snonblocking,\sthe\sread\swill\snever\sblock.\r\n\s\s\s\s\s\s\s*/\r\n\s\s\r\n!\s\s\s\s\sbytesRead\s=\sread(fsPtr->fd,\sbuf,\s(size_t)\stoRead);\r\n\s\s\s\s\s\sif\s(bytesRead\s>\s-1)\s{\r\n\s\s\s\s\s\s\s\sreturn\sbytesRead;\r\n\s\s\s\s\s\s}\r\n---\s253,262\s----\r\n\s\s\s\s\s\s\s*\snonblocking,\sthe\sread\swill\snever\sblock.\r\n\s\s\s\s\s\s\s*/\r\n\s\s\r\n!\s\s\s\s\sdo\s{\r\n!\s\s\s\s\s\s\sbytesRead\s=\sread(fsPtr->fd,\sbuf,\s(size_t)\stoRead);\r\n!\s\s\s\s\s}\swhile\s((bytesRead\s<\s0)\s&&\s(errno\s==\sEINTR));\r\n!\s\r\n\s\s\s\s\s\sif\s(bytesRead\s>\s-1)\s{\r\n\s\s\s\s\s\s\s\sreturn\sbytesRead;\r\n\s\s\s\s\s\s}
J foundin 8.6.*
J is_private 0
J login anonymous
J priority 5\sMedium
J private_contact f453a2d8b2491bec888a11ddd709eccbaa04b032
J resolution None
J severity Important
J status Open
J submitter anonymous
J subsystem 55.\sOther\sTools
J title Tclsh\sread\sloop\sdoes\snot\shandle\sEINTR
J type Bug
K 8419c55e2cb159f977b76cadb3cebe0353389b22
U anonymous
Z 6c28888290aae5f579e3b2247915376f