Ignoring fatal errors in Zcode

(David Griffith) #1

In 1999, for my “davepatch” superpatch to Frotz 2.32, I introduced an “-i” flag to ignore otherwise fatal errors that seemed to happen with Inform5 and early Inform6. Then for the 2.40 release, I removed that option. Why? Because in many cases, a fatal error is caused by subscripts of arrays getting larger than the array. When this happens, it’s easy to detect and abort before a segfault can occur. If the “-i” flag is used, then segfaults can happen. I put it back for version 2.41 after a few people told me about how they had problems playing “Enemies” (compiled by Inform5 library 5/12). A few days ago, someone reported Frotz throwing segfaults when “-i” is used and I remembered that the “-i” can do this. So… does anyone actually use the “-i” flag? Can I just get rid of it? Keep it and warn people “This can easily lead to segfaults”?

Inform 6.12 lib - Fatal Error
#2

I vote keep. Options are good to have. You have to use -i in order to exhibit the “two Dunbars” bug in Deadline.

(Piergiorgio d'errico) #3

Thinking on, because Frotz is the reference 'terp, I’m for conserving the -i flag, because is useful for debugging, esp. with its behavior governed by the -Z flag. -i -Z0 is what people playing enemies or showing historical bugs (as pointed by Nathan; let’s not forget the huge advance in the primary sources field… :slight_smile:

Best regards from Italy,
dott. Piergiorgio.

(David Griffith) #4

I see now the need to keep the option to ignore fatal errors. However, I will change how this is done. Currently, the -i flag is honored in common/err.c. This has the disadvantage of not calling os_fatal() which would otherwise give some potentially useful information prior to the potentially fatal operation. So, I’m assigning the responsibility to abort or not abort to os_fatal(). I’ve successfully implemented this for the dumb interface, but I’m having problems with the curses interface.

Doing this for the curses interface has interesting consequences when the otherwise fatal error has to do with an attempt to print at an illegal address. Balances.z5 release 5 (http://ifarchive.org/if-archive/games/zcode/Balances.z5) will produce a cascade of Fatal error: Illegal object followed by a Fatal error: Print at illegal address before Frotz crashes with a segfault. The printing of the final error message is corrupted in random ways depending on the size of the terminal at the time. Usually the message is printed with newlines missing before Frotz segfaults. Sometimes garbage is printed and Frotz manages to keep going.

(David Griffith) #5

Now the SDL interface handles the -i flag more sensibly.

Also with -i not used, the Frotz window will show everything up to [Press any key to exit] when a fatal eorrir is encountered. Formerly, the window would simply vanish and any errors would be printed to standard error.