.
D 2001-09-27T19:10:06
J assignee vincentdarley
J cmimetype text/plain
J comment Tcl\s8.3.3,\sOS\sPlatform\sAIX\s4.3.3\n\nThere\sis\san\sunfortunate\sinteraction\sbetween\stcl\sand\s\nUnix\ssystems\sthat\simplement\sthe\sSingle\sUnix\s\nspecification.\s\sIn\sparticular,\sthe\sSingle\sUnix\s\nspecification\sfor\swriting\sto/reading\sfrom\sa\sSTREAM\s\ndevice\srequires\sthat\sa\szero-length\swrite\son\sone\s\nside\sshow\sup\sas\sa\szero-length\sread\son\sthe\sother.\s\s\nThat\sis,\sa\szero-length\swrite\sgets\sinterpreted\sas\sEOF\s\nwhen\sread.\n\nhttp://www.opengroup.org/onlinepubs/007908799/\nxsh/write.html\nhttp://www.opengroup.org/onlinepubs/007908799/\nxsh/read.html\n\nThis\sis\sa\sproblem\sfor\stcl\sbecause\swhen\stcl\sflushes\s\nits\schannel\sbuffers,\sif\sthere\sis\snothing\sin\sthe\sbuffer,\s\ntcl\sends\sup\sperforming\sa\szero-length\swrite.\s\sIf\sthe\s\nchannel\shappens\sto\sbe\sconnected\sto\sa\sSTREAMS\s\nfile,\sthis\sappears\sas\sEOF\sto\sthe\sother\sside\sof\sthe\s\nSTREAM.\n\nThis\scauses\sgrief\sfor\sseveral\sprograms,\sincluding\s\nscript,\ssshd,\sand\sexpect.\s\sIt\shas\sthe\sinteresting\s\neffect\sthat,\sif\syou\sare\slogged\son\svia\sSSH\sand\srun\sthe\s\ntcl\stest\ssuite,\syou\sget\slogged\soff!\sduring\sio.test.\n\nFortunately,\sthere\sare\snot\sthat\smany\sOS's\sthat\s\nimplement\spseudo-tty's\son\sSTREAMS,\sbut\sIBM's\s\nAIX\s4.3.3\sis\sone.\n\nOne\scan\sargue\sthat\sthe\sspec\sis\swrong\sfor\schanging\s\nwhat\sused\sto\sbe\sa\sharmless\saction\s(writing\s\nnothing)\sinto\ssomething\sthat\snow\shas\sa\smeaning.\s\s\nHowever,\sthis\sis\sprobably\sa\slosing\sbattle.\s\sI\ssuggest\s\nthat\stcl\sbe\smodified\sto\savoid\szero-length\swrites.\n\nThe\sfollowing\spatch\schanges\sthe\sUnix\s\nFileOutputProc\sto\savoid\szero-length\swrites:\n\n---\sunix/DRT/tclUnixChan.c\s\s\s\s\s\sTue\sApr\s\s3\s17:54:39\s\n2001\n+++\sunix/tclUnixChan.c\s\sThu\sSep\s27\s14:04:58\s2001\n@@\s-423,6\s+423,8\s@@\n\s\s\s\s\sint\swritten;\n\s\n\s\s\s\s\s*errorCodePtr\s=\s0;\n+\s\s\s\sif\s(toWrite\s==\s0)\n+\s\s\s\s\s\s\sreturn\s0;\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s/*\savoid\szero-length\swrite\s\n*/\n\s\s\s\s\swritten\s=\swrite(fsPtr->fd,\sbuf,\s(size_t)\stoWrite);\n\s\s\s\s\sif\s(written\s>\s-1)\s{\n\s\s\s\s\s\s\s\s\sreturn\swritten;\n\nThis\shas\sbeen\stested\sonly\sto\sthe\sextent\sthat\sthe\stcl\s\ntests\snow\srun\son\sAIX\swithout\slogging\sme\soff.\n
J foundin obsolete:\s8.3.3
J priority 5\sMedium
J resolution None
J status Open
J submitter daletalcott
J subsystem 37.\sFile\sSystem
J title zero-length\swrite\sconsidered\sharmful
J type Bug
K 465765ffffffffffffffffffffffffffffffffff
U daletalcott
Z 5ef5209fc9a8da6405ec3f873187fccf