.
D 2011-11-11T17:29:38
J assignee andreas_kupries
J cmimetype text/plain
J comment Channel\stransforms\sand\s(multibyte)\sencodings\sbreak\sthe\sbyte/char\s1-to-1\smapping.\sAs\sa\sconsequence,\sthere\sare\scases\swhere\sthe\slow-level\s(resp.\sraw)\schannel\shas\sa\sbyte\sready\s(as\sdetected\sby\sthe\sselect()\sin\sthe\snotifier,\sletting\sa\s[fileevent\sreadable]\sfire),\sbut\sa\s[read\s1]\son\sthe\shi-level\s(resp.\sdecoded)\schannel\swould\sblock\s(if\sblocking)\sor\sreturn\sthe\sempty\sstring\s(if\snot).\n\nThe\spossibility\sof\ssuch\s"false\spositives"\sin\sreadable\sfileevents\sis\snot\sadvertised,\sand\sa\srecurring\sidiom\sis\n\n\s\s\sfconfigure\s$ch\s-blocking\s0\n\s\s\sfileevent\s$ch\sreadable\sfoo\n\s\s\sproc\sfoo\s{}\s{\n\s\s\s\s\s\sset\sdata\s[read\s$::ch\s1000]\n\s\s\s\s\s\sif\s{![string\slength\s$data]}\s{close\s$::ch;clean_things_up}\n\s\s\s\s\s\s#\suse\s$data\n\s\s\s\s}\n\nThis\sidiom,\sof\scourse,\sleads\sto\serroneous\struncation.\sThe\ssame\sthing\sat\sC\slevel\sleads\sto\s2762041\sand\s1945538.\nNote\sthat\sthis\smechanism\spotentially\sapplies\sto\sall\smultibyte\sencodings\sand\schannel\stransforms.\sTLS\sand\sZlib\sare\shighly\ssuspect\sof\ssuffering\sfrom\sthis,\salong\swith\sthe\subiquitous\s[-encoding\sutf-8],\sas\sshown\sby\sthe\sattached\sscript.\n\nTwo\soptions:\n\n\s(1)\sfix\sit\sthe\shard\sand\sclean\sway,\sby\sdoing\sa\sread-ahead\sinside\sthe\sNotifyProc\s(see\s1945538\sfor\sdetails).\sDo\sthis\sin\sthe\score\sfor\snon-single-byte\sencodings,\sand\sin\sthe\stransform-based\sextensions.\n\n\s(2)\swork\saround\sit,\sby\sstrongly\sdocumenting\sthe\sfact.\sPossibly\smany\sscripts\sto\sfix.\sStill\ssome\sC\scode\sto\supdate\sin\sextensions\smaking\sthe\swrong\sassumption,\sto\sstop\sthem\sfrom\sgiving\sfalse\sEOFs.\n\n
J foundin None
J is_private 0
J priority 8
J resolution None
J status Open
J submitter ferrieux
J subsystem 25.\sChannel\sSystem
J title Transforms/Encodings\smay\sgenerate\sfalse\sreadable\sfileevent
J type Bug
K 3436609fffffffffffffffffffffffffffffffff
U ferrieux
Z abcb28931d60e10842c46259ebd9d53f