[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: whatis loop



> I too saw this, but forebore from reporting it because I couldn't describe
> the circumstances.  It seems to depend on what environment variables I have
> going into es - if I unset the majority of them, then run es, "c" is no longer
> defined.  Of the letters of the alphabet, "c" is the only one with an
> accidental alias.

for the curious, here are some details on the problem.

the "fn-" and "set-" prefixes are searched for using the varlookup2() routine,
which in turn calls dictget2() to see if a dictionary (hash table) contains
a prefixed version of a string.  we use hash tables with linear probing in es,
so after we obtain the hash index, we probe until either a match occurs or
we find a NULL in the table.  the match is done with streq2() which was
returning false positives when the target was a prefix of the string being
matched against.

the reason that the problem happened some of the time and not others was that
it depended on hash collisions being in a specific order with enough collisions
that the hash values of "fn-c" and "fn-catch" were not separated by any NULL
entries.  for the extremely curious, the masked hash values of the two strings
were 52 and 57, requiring 5 intervening values.