Another bit of weirdness....

May 24, 2010
Northlake, Il
By far the best way to illustrate this problem is to show a (rather long because it is fully "instrumented" for debugging purposes!) code segment and its output (and the values of all of the relevant variables are shown in the output). So, first the code:
Iff "%FileRoot[%RootIndex]" == "" Then
   Set FileRoot[%RootIndex] = %FileKey
ElseIff "%FileRoot[%RootIndex]" == "%FileKey" Then
   @Echo Already in file root array: %FileKey
   Set RawIndex=%RootIndex
   Set CollisionCount = 0
   Do Until "%FileRoot[%RootIndex]" == "" .OR. ^
            "%FileRoot[%RootIndex]" == "%FileKey" .OR. ^
             %CollisionCount == %@ArrayInfo[FileRoot,1]
       Set CollisionCount=%@Inc[%CollisionCount]
       @Echo File root collision number %CollisionCount
       @EchoS    FileRoot[%@Right[4,0000%RootIndex]]:
       @Echo  %FileRoot[%RootIndex]
       @Echo     FileKey: %FileKey
       Set RawIndex=%@Eval[((%RawIndex SHL 1) AND ^
                           4294967295) XOR %RawIndex]
       Set RootIndex=%@Eval[%RawIndex MOD ^
   Iff "%FileRoot[%RootIndex]" == "" Then
      Set FileRoot[%RootIndex] = %FileKey
   ElseIff "%FileRoot[%RootIndex]" != "%FileKey"
      @EchoSErr Yes, error!  Comparison indicates
      @EchoSErr  that they do not match!
      Set QRS=%@Len[%FileRoot[%RootIndex]]
      Set RST=%@Len[%FileKey]
      Set STU=0
      If %QRS != %RST ^
         @EchoErr File root entry different length then file key.
         Set Mismatch=
         Do While %STU LT %QRS .AND. %STU LT %RST
            Iff "%@Instr[%STU,1,%FileRoot[%RootIndex]]" != ^
                "%@Instr[%STU,1,%FileKey]" Then
               @EchoSErr Mismatch: File root:
               @EchoSErr  "%@Instr[%STU,1,%FileRoot[%RootIndex]]"
               @EchoErr  FileKey: "%@Instr[%STU,1,%FileKey]"
               Set Mismatch=T
            Set STU=%@Inc[%STU]
         Iff "%Mismatch" == "T" Then
            @EchoSErr Internal Error: Unexpected results when
            @EchoErr  searching for file key "%FileKey" in file name array.
            @EchoSErr Final incorrect entry found was
            @EchoErr  "%FileRoot[%RootIndex]"
            @EchoSErr Internal Error: Unexpected results when
            @EchoErr  searching for file key "%FileKey" in file name array.
            @EchoErr     Search terminated but entry was found!
            Iff "%FileRoot[%RootIndex]" == "%FileKey" Then
               @EchoErr And this time file root: "%FileRoot[%RootIndex]"
               @EchoErr  matches file key: "%FileKey"!!!
               @EchoErr Again FileRoot[%RootIndex]: "%FileRoot[%RootIndex]"
               @EchoErr    And FileKey: "%FileKey"
And here is the (unexpected!) output of the above code:
Yes, error!  Comparison indicates that they do not match!
Internal Error: Unexpected results when searching for file key "Trans-2010-07-09.txt?01/21/10?19:29?14384" in file name array.
                Search terminated but entry was found!
And this time file root: "Trans-2010-07-09.txt?01/21/10?19:29?14384"
       matches file key: "Trans-2010-07-09.txt?01/21/10?19:29?14384"!!!
I will add that after I ran and then extracted the above code I added some instrumentation to show exactly how often this error occurs, and the output of that is:
There were 3 faux failures.
3 of those failures were confirmed to be faux in the sense that they were
not repeatable, out of 10 iterations of the code in question.
Which is a confirmed faux failure percentage of 30%
(which means, of course, that the code in question works correctly
70% of the time).
I am using the word "faux" because they are really not failures in the sense that they are not even repeatable! (That is, when comparing the strings again in the code to display the error output both character-by-character and in toto indicates that they truly are equal!)
Similar threads
Thread starter Title Forum Replies Date
jdanielp Cannot step into and/or call another .bat file when debugging .bat file Support 2
vefatica Another popup problem Support 10
S How to? Runs start /w in invisible mode OR run program after exit of another one Support 3
G Press on another Window Support 24
M Another possibly strange remote registry issue Support 5
vefatica Another problem with build 22. Support 3
Patulus Yet another thread on CMD compatibility Support 16
M Take Command 18, migrating to another machine, license problem. Support 1
MickeyF Another TPIPE question Support 6
vefatica Another installer thingy Support 1
vefatica Another @EVERYTHING question Support 4
C Touch command — I Need to touch matching files in another directory. Support 5
M Another "What is wrong?" Support 8
Bill de Haan Another installation is in progress Support 6 Another Problem with The Installer Support 1
Charles Dye Another modest proposal Support 4
Dan Glynhampton Documentation v15 help: Another mailto: link oddity Support 0
M WAD Another weird copy command errror... Support 2
M Yet another strange something re something called "@TCONVERT" Support 8
Charles Dye Documentation Another help nit Support 3
K_Meinhard Documentation Another installer nit Support 1
ehab aboudaya How to? change ALT-F6 to another key Support 1
A How to? Pass output from ffind to another command in a BTM file Support 5
M Another simple question re. Take Command/TCC window witdth in characters... Support 16
Q TCC: (Sys) The process cannot access the file because it is being used by another process. Support 0
S MOVE from FTP directory to another FTP directory - bug?? Support 2
vefatica Another debugger observation Support 12
vefatica Another DO /L question Support 1
M Another TCMD "crash" situation... Support 2
S Need help to execute TCC commands on another system Support 6
B TCC doesn't run using another user Support 2
H Another multiple FTP password prompt issue Support 2
Peter Bratton Another little bug? Support 1
M Another problem with renaming files... Support 3
nikbackm Another HISTORY dialog issue Support 0
vefatica Another help nit Support 12
S Another 4NT 8.02 vs TCC 9.02 diff - MOVE command Support 3
p.f.moore Running another batch file without CALL Support 7
Peter Murschall Single-line Do-CMD is a bit uncooperative. Support 6
Joe Caverly VBEEP on 64-bit Support 3
vefatica SETP usually fails with a 32 bit process Support 4
rconn Dropping 32-bit support in Take Command & TCC? Support 14
dcantor How to? Can 32-bit TCC be run on a system with 64-bit TCMD and TCC installed? Support 6
T 32 and 64 bit simultaneous portable versions Support 2
vefatica Make FFIND a bit more friendly? Support 14
CWBillow Everything.exe - 64-bit? Support 8
S 32-bit Take Command v22 install for thumb drive Support 1
Per TCC/LE 14 64-bit won't start on Windows 10 Insider Preview 17063 (171213) Support 12
Joe Caverly SETP and 32-bit process Support 2
gworley How to? Take Command 20 64 bit vs 32 bit Support 1

Similar threads