Re: Chris Sonnack on VB.Net's putative Set statement

From: Programmer Dude (Chris_at_Sonnack.com)
Date: 06/15/04


Date: Tue, 15 Jun 2004 09:48:04 -0500

Edward G. Nilges writes:

> I found and fixed the problem in the code the same evening it
> was posted without your assistance.

A lie. A bald-faced lie. Which we now expose (again).
Ed, Your Own Words Name You Liar!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Subject; Re: The Data Quality Act
   Date; Wed, 26 Jun 2002 16:19:37

[Ed posts his C code string tokenizer...]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Subject; Re: The Data Quality Act
   Date; Thu, 27 Jun 2002 15:10:57

I spent a hour or so re-writing the C version to what I would
consider good C practice (and per my own style just for example).
In the process I found a SERIOUS bug in the C code. It occurs on
line 131 of the C text, in the main parse function:
[...]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Ed still in denial two days later...]

Subject; Re: The Data Quality Act
   Date; Fri, 28 Jun 2002 12:33:39

CS> The allocated string has no room for the trailing nul.

RH> Sorry for missing this during my own review.

EN> You missed it because you know C and it isn't there.

Sorry, Ed, you're in *serious* denial here. There are two major
bugs in your "parsing" function. The first is exactly what I said
it is, and I'll go over it more carefully for you. [..snip...]

> You appear not to have done your homework, for if the bug had been
> in the original it would have blown up immediately, and you did not
> bother to test your proposed code scrap.

Guess what, Ed. I loaded your original, unmodified (mod line wrapping)
source into VC++ and it DOES crash reporting:

    +--------------------------------------------------+
    | DEBUG ERROR! |
    | Program: Test-D.exe |
    | DAMAGE: after Normal block (#40) at 0x00300150 |
    | (Press Retry to debug the application) |
    | |
    | [Abort] [Retry] [Ignore] |
    +--------------------------------------------------+

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Still swimming in De Nile...]

Subject; Re: The Data Quality Act
   Date; Fri, 28 Jun 2002 18:16:52

> Dude claimed a bug which I have checked out and there is no bug in
> this code:
> [...]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Finally Ed begins to acknowledge there "may" be a bug...]

Subject; Re: The Data Quality Act
   Date; Fri, 28 Jun 2002 18:24:17

> This MAY be a genuine bug.

No MAY about it.

[...]

> I think having written this that you probably ARE wrong, but I am
> going to take your post home. You were certainly wrong on the null
> length issue and at best are 1 for two down.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Finally, four days later, Ed acknowledges (NOT FIXES)...]

Subject; Re: The Data Quality Act
   Date; Sun, 30 Jun 2002 23:24:16

> OK. It appears that the malloc needed to malloc one more byte.

Yes.

> Chris is probably one for two since I believe a null string with a
> string delim is handled.

I'm afraid the other bug still exists. It has to do with what happens
with you "parse" a string using string delimiting, but the string has
no delimiter present.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Still no acknowledgement of error or simple test cases...]

Subject; Re: The Data Quality Act
   Date; Tue, 09 Jul 2002 17:05:02

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[And STILL not...]

Subject; Re: The Data Quality Act
   Date; Thu, 11 Jul 2002 13:06:19

> I think the problem is that I presented end-to-end solutions which
> worked the first time out,...

No, they didn't. Your C solution crashed immediately and refused
to run until I fixed your error. Even then it produced erroneous
results due to the other bug. That's two major bugs in the single
function of substance in your C solution.

Your VB solution at least runs, but it's poorly designed--particularly
for a tool object. Worse, I say it ALSO produces erroneous results:

For the string: ",Moe,,Larry,Curley,,Shemp,Curley-Joe,CurleyJoeBesser,"

[NOTE: That was YOUR test string, Ed.]

Your VB routine claims there are *nine* tokens. Do you feel there
should be a (blank) token *after* the final comma? That would make
10 tokens...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Present day, years later, finally (after asking a dozen times):]

CS> ..how many fields in the following CSV: ",John,,Rogar,Mick,"

EN> There are duh six fields in the string.

Exactly. So why did both your programs report five?

-- 
|_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL  |
|_____________________________________________|_______________________|


Relevant Pages

  • Re: [EGN] Variable hoisting
    ... Re: The Data Quality Act ... In the process I found a SERIOUS bug in the C code. ... CS> The allocated string has no room for the trailing nul. ... An mature adult programmer would have taken it for what ...
    (comp.programming)
  • Re: PLEASE READ (was Re: recursive proofs)
    ... Re: The Data Quality Act ... Note in both cases, "Look, Ma, no string limits!" ... The lack of comments is one reason I'm not going to bother wading ... In the process I found a SERIOUS bug in the C code. ...
    (comp.programming)
  • Re: Comment on trim string function please
    ... I think you have a bug. ... but does it fly past the terminating null character? ... initial space scan) then this writes outside the string. ... ASIDE FROM THE CAST "ISSUES", ...
    (comp.lang.c)
  • Weekly Python Patch/Bug Summary
    ... Patch / Bug Summary ... most missing from Windows distribution ... http://python.org/sf/1541585 closed by gbrandl ... Compiler command percent-sign causes format string error ...
    (comp.lang.python)
  • Re: DCL question (of the day)- null byte in string symbol
    ... I have pointed out that this code was just to show the bug, ... Subject: Re: DCL question - null byte in string symbol ... Lexical substitution is a possibility. ...
    (comp.os.vms)