Open nikhilgupta10 opened 7 years ago
nikhilgupta10 imported these comments from Sourceforge: "pdouglass":P.s. the last lines should more correctly read:
groupid!=Special_Triplex_Meter
to be
groupid>Special_Triplex_Meter
So it looks like 5 of the 6 string comparison functions are broken.
,
"dchassin":This can be confirmed by looking at core/find.c:compare(). PT_CLASS, PT_MODULE, and PTGROUPID are all (char). All the functions should use (char) and not (char_*).
Also, the \one\ and wo\ variables in compare_string_eq look like debugging code that never got taken out. They should be removed. There's no reason it should not look like the other functions in the same family.
,
"dchassin":- Description has changed:
Diff:
The problem came when I tried to define two collectors: one collector for all houses with a given groupid, and a second collector for all the other houses. Instead of defining a second groupid for the second group, I just negated the logical expression matching groupid, and that's what caused the crash. Code snippet:
...
...
With a little help from my debugger, I traced the crash to line 594 of find.c, and the function \compare_string_ne().
I became suspicious when I saw some strangeness with the related \compare_string_eq()\, which was introduced in revision 1079. The section from find.c is:
int compare_string_eq(void *a, FINDVALUE b) {
}
int compare_string_ne(void a, FINDVALUE b) { return (char )a != NULL && strcmp((char*)a,b.string)!=0;}
I don't completely follow why the \compare_string_eq()\ looks different from the other compare functions, but it lead me to try a similar implementation for \compare_string_ne()\ which worked. Actually, all I needed to do was change the *(char *)\ references to (char )\ .
I could also provoke a crash by changing
groupid!=DVCR_Triplex_Meter
to be
groupid>DVCR_Triplex_Meter
So it looks like all 5 of the string comparison functions are broken.
,