Skip to content
Tcl Source Code Artifact [4a6734106c]
Login

Artifact [4a6734106c]

Artifact 4a6734106c77c7bf2bba0724ff83eddd36e25769:

Ticket change [4a6734106c] - New ticket [218435ffffffffff|218435ffff] <i>Binary format errors</i>. by nobody on 2000-10-26 00:57:34.
D 2000-10-26T00:57:34
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s6156\sBug\nVersion:\s8.3.2\nSubmitDate:\s'2000-08-23'\nLastModified:\s'2000-08-25'\nSeverity:\sSER\nStatus:\sClosed\nSubmitter:\stechsupp\nChangedBy:\sericm\nOS:\sWindows\s95\nFixedDate:\s'2000-10-25'\nClosedDate:\s'2000-08-25'\n\n\nName:\nBrent\sIwanoczko\n\nComments:\nHelp,\sASAP\s:)\sTheres\sa\semulator\sthats\swaiting\sto\sbe\sbuilt,\sfailure\shere\n\s\s\s\sfor\sany\sreason\smeans\swe\scant\suse\sTK/Tcl,\sand\sthe\sintention\sto\spurchase\sa\n\n\s\s\s\sTCLPRO\ssupport\slicense\swill\sbe\snull\sand\svoid.\n\nReproducibleScript:\nTry\sthe\sfollowing\s2\scommands\sin\syour\sconsole.\n\nEXPECTED\sRESULT\s-\sWhen\syou\sput\sthe\sbelow\soutput\sdown\sa\ssocket,\sthe\sfilevent\son\sthe\sclient\swill\sget\scalled\sonce,\sand\sa\sgets\son\sthe\ssocket\swill\sget\s32\sbytes\sof\sdata.\nset\sx\s[binary\sformat\sIa8IIIcccB8cxxx\s124\sWxYz0000\s967004765\s967004765\s32\s0\s0\s13\s01010101\s1]\n\nUNEXPECTED\sRESULT\s-\sWhen\syou\sput\sthe\sbelow\soutput\sdown\sa\ssocket,\sthe\sfilevent\son\sthe\sclient\swill\sget\scalled\stwice,\sthe\sfirst\stime\sgetting\s28\sbytes,\sthe\ssecond\stime\sgetting\s3\sbytes.\sSo\snot\sonly\sis\sthe\sgets\ssplit,\syou\salso\slose\sa\sbyte.\nset\sx\s[binary\sformat\sIa8IIIcccB8cxxx\s124\sWxYz0000\s967002665\s967002665\s32\s0\s0\s8\s01010101\s10]\nThis\swill\sdisplay\sa\sbinary\sstring\sthat\sappears\sto\sbe\ssplit\sover\s2\slines,\saltho\sthe\slength\sregisters\sas\s32\sbytes\sas\sexpected.\n\nThe\ssockets\sin\sall\scases\sare\sfconfigure\s-translation\sbinary\s-encoding\sbinary\n\nAs\sit\sstands,\sthe\sbinary\sformat\scommand\sis\snot\sable\sto\sbe\sused\sreliably,\sas\severy\snow\sand\sthen\swith\sdifferent\sdata\scombinations,\syou\sget\sunexpected\sresults.\n\nObservedBehavior:\nTry\sthe\sfollowing\s2\scommands\sin\syour\sconsole.\n\nEXPECTED\sRESULT\s-\sWhen\syou\sput\sthe\sbelow\soutput\sdown\sa\ssocket,\sthe\sfilevent\son\sthe\sclient\swill\sget\scalled\sonce,\sand\sa\sgets\son\sthe\ssocket\swill\sget\s32\sbytes\sof\sdata.\nset\sx\s[binary\sformat\sIa8IIIcccB8cxxx\s124\sWxYz0000\s967004765\s967004765\s32\s0\s0\s13\s01010101\s1]\n\nUNEXPECTED\sRESULT\s-\sWhen\syou\sput\sthe\sbelow\soutput\sdown\sa\ssocket,\sthe\sfilevent\son\sthe\sclient\swill\sget\scalled\stwice,\sthe\sfirst\stime\sgetting\s28\sbytes,\sthe\ssecond\stime\sgetting\s3\sbytes.\sSo\snot\sonly\sis\sthe\sgets\ssplit,\syou\salso\slose\sa\sbyte.\nset\sx\s[binary\sformat\sIa8IIIcccB8cxxx\s124\sWxYz0000\s967002665\s967002665\s32\s0\s0\s8\s01010101\s10]\nThis\swill\sdisplay\sa\sbinary\sstring\sthat\sappears\sto\sbe\ssplit\sover\s2\slines,\saltho\sthe\slength\sregisters\sas\s32\sbytes.\n\nThe\ssockets\sin\sall\scases\sare\sfconfigure\s-translation\sbinary\s-encoding\sbinary\n\nAs\sit\sstands,\sthe\sbinary\sformat\scommand\sis\snot\sable\sto\sbe\sused\sreliably,\sas\severy\snow\sand\sthen\swith\sdifferent\sdata\scombinations,\syou\sget\sunexpected\sresults.\n\nDesiredBehavior:\nI\sexpect\sto\ssee\sthe\sbinary\sformat\scommand\sto\salways\sconstruct\sa\sstring\sthat\sdoesnt\shave\ssome\skind\sof\sline\sbreak\simbedded\sin\sit.\sSo\sthat\sa\sgets\son\na\ssocket\sgets\sall\sthe\sdata\ssent\swith\sthe\sputs\scommand,\snot\sbits\sof\sit.\n\n\n\nFrom\scomp.lang.tcl\s(thanks\sto\sDan\sKuchler):\n\nIf\syou\suse\s'gets'\sto\sread\sfrom\sa\ssocket\sthat\shas\sbinary\sdata\splaced\non\sit,\sand\sone\sof\sthe\scharacters\sin\sthe\sdata\s(when\sinterpretted\sas\na\sstring)\sis\san\send-of-line\scharacter\s(character\scodes\s10\sand\s13\nI\sbelieve)\sthen\sthat\scharacter\swill\sbe\sswallowed\sas\san\send-of-line\ncharacter,\swhich\sis\swhat\syou\sare\sobserving.\s\sThe\ssolution\sis\sto\suse\n'read'\swhich\sdoesn't\slook\sfor\send-of-line.\n\nOn\sserver\s(process\s1):\n---------------------------------------------------------\nset\sserver\s\s[socket\s-server\s[list\sfoo]\s9000]\n\nproc\sfoo\s{channel\sclientaddr\sclientport}\s{\n\s\s\s\sfconfigure\s$channel\s-translation\sbinary\n\s\s\s\sfileevent\s$channel\sreadable\s[list\sbar\s$channel]\n}\n\nproc\sbar\s{channel}\s{\n\s\s\s\sif\s{[eof\s$channel]}\s{\n\s\s\s\s\s\s\s\sclose\s$channel\n\s\s\s\s}\selse\s{\n\s\s\s\s\s\s\s\sset\sres\s[read\s$channel]\n\s\s\s\s\s\s\s\sputs\s"string\slength\s[string\slength\s$res]"\n\s\s\s\s\s\s\s\sbinary\sscan\s$res\sc*\sresult\n\s\s\s\s\s\s\s\sputs\s"number\sof\sbytes:\s[llength\s[split\s$result]]"\n\s\s\s\s}\n\s\s\s\sreturn\n}\nvwait\sforever\n---------------------------------------------------------\nOn\sthe\sclient\s(process\s2):\n---------------------------------------------------------\n\n#\sFirst\stry\sthe\sstring\sfrom\syour\s'expected\sresult'\ssection:\n\nset\sclient\s[socket\slocalhost\s9000]\nfconfigure\s$client\s-translation\sbinary\nset\sx\s[binary\sformat\sIa8IIIcccB8cxxx\s124\sWxYz0000\s967002665\s967002665\n32\s0\s0\s8\s01010101\s10]\nputs\s-nonewline\s$client\s$x\nflush\s$client\nclose\s$client\n\n#\sThen\stry\sthe\sstring\sfrom\syour\s'unexpected\sresult'\ssection:\n\nset\sclient\s[socket\slocalhost\s9000]\nfconfigure\s$client\s-translation\sbinary\nset\sx\s[binary\sformat\sIa8IIIcccB8cxxx\s124\sWxYz0000\s967002665\s967002665\n32\s0\s0\s8\s01010101\s10]\nputs\s-nonewline\s$client\s$x\nflush\s$client\nclose\s$client\n--------------------------------------------------------\noutput:\n---------------------------------------------------------\nstring\slength\s32\nnumber\sof\sbytes:\s32\nstring\slength\s32\nnumber\sof\sbytes:\s32\n\n\nWhen\sI\schange\sthe\sbar\sprocedure\sto:\n\nproc\sbar\s{channel}\s{\n\s\s\s\sif\s{[eof\s$channel]}\s{\n\s\s\s\s\s\s\s\sclose\s$channel\n\s\s\s\s}\selse\s{\n\s\s\s\s\s\s\s\sgets\s$channel\sres\n\s\s\s\s\s\s\s\sputs\s"string\slength\s[string\slength\s$res]"\n\s\s\s\s\s\s\s\sbinary\sscan\s$res\sc*\sresult\n\s\s\s\s\s\s\s\sputs\s"number\sof\sbytes:\s[llength\s[split\s$result]]"\n\s\s\s\s}\n\s\s\s\sreturn\n}\n\nAnd\sretry\sI\sget:\n\nstring\slength\s28\nnumber\sof\sbytes:\s28\nstring\slength\s3\nnumber\sof\sbytes:\s3\nstring\slength\s28\nnumber\sof\sbytes:\s28\nstring\slength\s3\n\nThis\sis\sbecause\s(according\sto\sthe\sman\spage):\n\n\nNAME\n\s\s\s\s\s\s\sgets\s-\sRead\sa\sline\sfrom\sa\schannel\n\nSYNOPSIS\n\s\s\s\s\s\s\sgets\schannelId\s?varName?\n_________________________________________________________________\n\n\nDESCRIPTION\n\nThis\s\scommand\s\sreads\sthe\snext\sline\sfrom\schannelId,\sreturns\neverything\sin\sthe\sline\sup\sto\s(but\snot\sincluding)\sthe\s\send-\nof-line\scharacter(s),\sand\sdiscards\sthe\send-of-line\scharacĀ­\nter(s).\n\n\n--\n\n\s\s\sEric\sMelski\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sThe\sOther\sTcl\sGuy\n\s\s\sericm\sat\sajubasolutions.com\s\s\s\s\s\s\s\s\s\s\s\sAjuba\sSolutions\n\s\n--\s08/25/2000\sericm
J foundin obsolete:\s8.3.2
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title Binary\sformat\serrors
J type Bug
K 218435ffffffffffffffffffffffffffffffffff
U nobody
Z 894fca703011c7f92565cb1645fb2cf7