I thought it might be useful to do a stream-of-consciousness post about what a programmer does when he or she sees a bug and wants to fix it.
The bug in question is in DrScheme, and it’s triggered whenever one goes to the Special menu and runs an “Insert Test Case”. From that point on, the resulting program is uncompilable, with the following error message:
require: broken compiled code (phase 0, defn-phase 0): cannot find module |,/Users/dyoo/local/plt/collects/test-suite/private/test-case| in: test-case
The first thing I wanted to do was isolate the problem: what code is responsible? I knew the functionality in question had something to do with “Insert Test Case”, so let’s start there.
mithril:~ dyoo$ cd local/plt/collects/
mithril:~/local/plt/collects dyoo$ cd string-constants/
mithril:~/local/plt/collects/string-constants dyoo$ grep 'Insert Test Case' *
english-string-constants.ss: (test-case-insert "Insert Test Case")
portuguese-string-constants.ss: (test-case-insert "Insert Test Case")
I had some previous knowledge that the menus in DrScheme were all internationalized, so I could start by searching through the string-constants directory to start my search. Whatever code uses test-case-insert is probably related, so we should start searching for occurrences of that now.
mithril:~/local/plt/collects/string-constants dyoo$ cd ..
mithril:~/local/plt/collects dyoo$ grep -r test-case-insert *
A bunch of output spews out, but I’ll ignore anything dealing with string constants; if I do that, I see that there’s a particular collection called test-suite, and that sounds promising.
Next thing to do: let’s see if anyone else has already tried looking at this, by searching http://bugs.plt-scheme.org. Yup, there appear to be a few. Bugs 7001, 7317, and 7373 seem to be the same bug. Ok, time to read those bugs reports thoroughly just to make sure I understand what other people have said about this.
Ok, it looks like Robby mentioned a workaround: if the user enters:
(require (lib "test-case.ss" "test-suite" "private"))
then things should work out. Yup, I can verify that this works. But that seems really odd to have to do this!
I’ll start to look at test-suite and see what the overall flow of the program is.
[will fill in as soon as I finish doing a review]
Well, I traced the issue down to how the snips make external requirements that can’t always be met, especially in modularized code. I posted a question about it in the PLT list, and then, a few days later, they were obliterated altogether.
So, in summary: the code I studied is no longer relevant. It happens.