.
D 2000-10-26T01:08:29
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s2871\sBug\nVersion:\s8.2\nSubmitDate:\s'1999-09-23'\nLastModified:\s'1999-10-20'\nSeverity:\sSER\nStatus:\sReleased\nSubmitter:\stechsupp\nChangedBy:\shobbs\nOS:\sLinux-SuSE\nOSVersion:\s6.0\nMachine:\sOther\nFixedDate:\s'1999-10-20'\nFixedInVersion:\s8.2.2\nClosedDate:\s'2000-10-25'\n\n\nName:\nHans\sBanken\n\nReproducibleScript:\n#!/usr/bin/tclsh\n\s\s\s\sset\sstr\s"0123456789\\x00\\\sabcdedfghi"\n\s\s\s\sputs\s"str:\s$str"\n\s\s\s\sputs\s"before\sscan\s-\scompare\sindex\s10\swith\s\\x00:\s[string\scompare\s[string\sindex\s$str\s10]\s\\x00]"\n\s\s\s\sbinary\sscan\s$str\sH*\sdump\n\s\s\s\sputs\s"access\swith\sstring\sindex:\s$dump\\ncompare\sindex\s10\swith\s\\x00:\n\s\s\s\s[string\scompare\s[string\sindex\s$str\s10]\s\\x00]"\n\s\s\s\sputs\s"access\swith\sstring\srange:\s$dump\\ncompare\srange\s10,10\swith\s\\x00:\n\s\s\s\s[string\scompare\s[string\srange\s$str\s10\s10]\s\\x00]"\n\n\s\s\s\s#\sExecuting\sthis\sscript\sresults\sin:\n\s\s\s\s#\s\s\sstr:\s0123456789\sabcdedfghi\n\s\s\s\s#\s\s\sbefore\sscan\s-\scompare\sindex\s10\swith\s:\s0\n\s\s\s\s#\s\s\saccess\swith\sstring\sindex:\n\s\s\s\s30313233343536373839002061626364656466676869\n\s\s\s\s#\s\s\scompare\sindex\s10\swith\s:\s-1\n\s\s\s\s#\s\s\saccess\swith\sstring\srange:\n\s\s\s\s30313233343536373839002061626364656466676869\n\s\s\s\s#\s\s\scompare\srange\s10,10\swith\s:\s0\n\nObservedBehavior:\nYou\smight\sget\swrong\sresults\swhen\scomparing\sthe\sresult\sof\sa\sstring\sindex\n\s\s\s\soperation\n\n\n\nThis\sis\stricky.\s\sWhat\sis\shappening\sis\sthat\sthe\suser\sis\sshimmering\nthe\sobject\sbetween\sa\sstring\sand\sa\sbytearray.\s\s'string'\shas\san\noverloaded\suse,\swhere\sit\swill\saccess\sa\sbytearray\sby\sbytes,\sand\nstrings\sas\sstrings.\s\sIn\sthe\sfirst\scase,\syou\sget\sthe\sunicode\nversion\sof\s\\x00.\s\sIn\sthe\ssecond,\syou\sget\sthe\strue\sone-byte\s\\x00\n(just\sa\snull\sbyte),\swhich\sis\snot\sthe\ssame\sas\sthe\sunicode\sone\n(which\sis\stwo\sbytes).\s\sIn\sthe\sthird\scase,\sSTR_RANGE\screates\na\sbytearray\sobj,\swhich\swill\sget\sconverted\sOK.\s\sThe\sproblem\sappears\nto\sbe\sthat\sSTR_INDEX\sfor\sbytearrays\swants\sto\sreturn\sa\sstring\stype\sobj.\s\n--\s09/24/1999\shobbs\nFixed\s10/20/1999\s(for\s8.3b1)\sby\smaking\sSTR_INDEX\sfor\sByteArrays\nreturn\sa\sByteArray\sobject.\s\n--\s10/20/1999\shobbs
J foundin obsolete:\s8.2
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title string\scompare\swith\sresult\sfrom\sstring\sindex\sdoes\snot\swork\sp
J type Bug
K 218947ffffffffffffffffffffffffffffffffff
U nobody
Z 1ac60dea5592341d336b6b75b3a16f9a