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