Craig’s Bug

One of the things I love about this job is tracking downinteresting bugs.  It’s like readinga good who-done-it, complete with plot twists, multiple potential suspects and a fascinating array of characters. Late last September, Craig Eisler submitted a bug that had all of these elements.

Now, when your general manager submits a bug, you don’t necessarily have to get on it right away. But, it’s not a good idea to let it linger for too long.  So, after this bug had been on the list for about a week or so, I decided it was time to figure out what was up.

The bug involved a document Craig had been editing with revision marking turned on.  He’d made some changes to the document, saved it, quit Word and, when he opened the document back up, some of the spaces between words were missing.

With a bug like this, the first thing I do is open it up in Win Word.  If the problem appears there, then there’s a strong likelihood that the bug is in the code that writes the file.  If the bug doesn’t appear in Win Word, then I know to start looking at the code that reads files.  In this case, the problem appeared in Win Word, so my first suspect is going to be somewhere in the save code.

Also, the missing spaces seemed to be in or around areas of the document where revisions had been made.  So, the first suspect was somewhere in the code that writes revisions.  I created a document, added some text, turned on revisions made some changes and saved the file stepping through the code that handles revision marking.

Nothing.  Everystep along the way, everything was happy. The code was writing all the appropriate XML tags, and none of the text was missing.  Of course those two sentences summarize about two-three hours of sleuthing, after which I was able to exclude the revision marking save code as a suspect.

Well, maybe it’s something that only appears to be related to revision marking.  Let’s take two files, one that exhibits the problem and one that doesn’t, and compare the contents (much easier to do now that the document content is XML).

Again, nothing. Other than a few gratuitous differences (revision save ID’s, for example, which are uniquely generated every time new text is saved in a document), everything in and around the missing spaces was identical.  Another couple of hours spent cracking open various documents and comparing the XML, and I still haven’t a clue whothe real culprit is.

Well, but, if the documents are identical, maybe the problem happens when we read the file.  So, I set a breakpoint on the code that handles runs of text from the XML parser, and, sure enough, our “characters” callback wasn’t getting called for just the missing spaces.  Hm…  Progress.

About another hour or so, I had tracked it down to some general XML parsing code we’d ported from Win Office.  One of the problems with writing filing code that’s intended to handle future situations is that, when you write the code, the future hasn’t arrived yet.  Well, for Win Office, Mac Office represented the future, and some of the stuff we’d added exposed a subtle bug in the code we’d ported (note: the problem has been fixed in WinOffice before Mac Office shipped, so people shouldn’t run into this at all).

By the time I had finished all of this, implemented a fix and verified the fix, it was about 1:30 in the morning.  When I get engrossed in a good mystery, I sometimes find it difficult to put the book down.  Same thing goes with good mystery bugs.

And, the bug being a good mystery bug that geeks like Craig and I appreciate, I sent off an e-mail to Craig outlining the basic nature of the bug and the fix (which turned out to be just a couple lines of code—this is almost always the case with a good mystery bug).  This being in the middle of the FIFA Women’s World Cup, I ended the mail by saying that I was going to go home, drink some coffee, and stay up to catch the USA match (I forget who the opponent was).

The next day, I got a response from Craig with some questions about the bug.  I replied to Craig’s questions and, at the end of the e-mail, lamented over the fact that, after all that effort and all that coffee to stay up to watch a soccer match, our local cable company saw fit to pre-empt the last 30 minutes of the match with a taped question-and-answer program starring Mike Holmgren, the Seahawks coach.

For a born-in-Green-Bay, prick-me-and-I-bleed-green-and-gold, Packers fan like me, having a soccer match for which I’d stayed up all night to be able to watch be preempted by Mike Holmgren is seriously rubbing salt into the wound, and I conveyed my displeasure at this to Craig by saying that the only reason we still have a working television in the house is the fact that there were people asleep in the house at that time.

What ensued was a series of e-mails between Craig and I with a dual thread about the bug he’d reported and my television set.  His response to my previous e-mail was to suggest that I should have taken the TV outside and smashed it there.  Wake up the neighbors instead of the kids, and I get to vent my hostilities.

In my reply, I explained that this was not an option giventhe size (36”) and weight (over 260 lbs) of my TV set, to which Craig replied, “A CRT!?  How quaint!  Do you get slivers when you go to the bathroom after watching that TV?”

Having an uber-geek general manager is cool.  You get great bug reports, and he likes to hear about the nature of the bug and the fix.  Just be a little careful when you talk about the technology around your house.



Currently playing in iTunes: New World Blues by Gov’t Mule 

Comments (9)

  1. Ahem…

    Speaking of missing spaces between words…

  2. hansel says:

    and you removed a few spaces on this blog post as well… heh

  3. Rick Schaut says:

    Oh, the ironies.  Rather than use a proper blog editor, I’d written the original of this post in Word, and pasted into the blog editing form within Safari.  The two didn’t exactly communicate all that well with each other, with the result of a blog post that exhibited the same problem.

  4. jesam says:

    I have yet to see a flatpanel that with regular TV (not HD) gives as good an image as my CRT.  The colors are never what they should be ans the picture looks sharp but coarse (strange but true).

    And that is on the Sony of my mum, and the Loewe of my father in law, so that’s on A brands.

    I’ll wait until my CRT dies.


  5. Rosyna says:

    So you’ve also discovered a missing spaces bug when copying text out of Word?

  6. Rick Schaut says:


    I believe so.  It’s hard to say whether the bug is in Word, Safari or the blog software, though I’m inclined to think it’s the latter.

  7. Rosyna says:

    Well, it wouldn’t be in Safari. Since it’s getting the text from the pasteboard. I’m not sure if Word uses promises or not, but the known issues list for Word mentions a few copy/paste bugs. Which makes it sound more likely to be in Word. Unless word is using an ignorable for some spaces in some situations.

  8. Rick Schaut says:

    First, I’ve learned to never rule out a source for a problem until I have the actual cause tracked down :-).

    Second, as I’d said, the mostly likely culprit is the blog software that handle’s the submit from the form.  Copy and paste from Word into Text Edit, for example, is fine.

    Lastly, the one case where Safari might be the locus of the problem would be the ordering with which Safari chooses particular clipboard formats vis-a-vis the formats that Word promises to make available.  It’s not likely, but, as I said, never rule out a suspect until you have proof in hand.