LF: Fixed version of CORE.O


[Prev][Next][Index][Thread]

LF: Fixed version of CORE.O



In mid-october, I was informed by Josh Franta (WhoDaMan on IRC) that Fargo
had a bug. He was able to isolate and reproduce this bug, which led me to
find what was causing it. I actually did fix this bug, and I knew that I
had fixed it. So (foolishly), I didn't run any tests to see if it was still
there. :)

As you all know, Fargo has library support. Programs can use code located
in separate program files. What this means, however, is that Fargo needs to
check to make sure that all the libraries required by a program are
actually present in memory. If they are not, the program will not run
(depending on how it's executed, it will either pop up an error message or
flash the screen).

There is a location in every Fargo program that lists all the libraries
that program uses. These libraries, by nature, must be listed in some
order, however arbitrary that order may be. The bug happened when the first
(or first few) libraries were found, but one of the remaining libraries was
*NOT* found. This would cause the program relocation routine to stop dead,
leave programs in various states of incomplete relocation. When one of
these programs was executed again, with *ALL* the needed libraries present,
the double-relocation performed would result in invalid program code which
would cause fatal errors such as "Address Error", "Illegal Instruction", etc.

I fixed this bug by separating the relocation procedure into two parts; one
enumerates all the required libraries, and checks to make sure they are
present; and if this succeeds, it then chains to the next routine, which
procedes to relocate all the libraries.

By restructuring the way the program-loading routine worked internally, I
fixed the core bug. Since I knew that I had fixed the bug, I (foolishly)
did not procede to test it afterwards. It turns out that I neglected to
remove one instruction that was left over from the old routine. Josh Franta
pointed out to me today that the bug is still there. (Actually it is
slightly different, but under most conditions behaves the same way.) I
deleted the instruction; now Fargo works fine, and is 4 bytes smaller. :)

I'm attaching the fixed CORE.O to this message. You will need to run
PUTFARGO again to incorporate it into your Fargo backup file.

Core.o



---
David Ellsworth
the ticalc.org project
davidell@ticalc.org
---