Subject: Bug#3807: Bug #3807 explained

From: Rickard Westman <[email-masked]>
Date: Wed, 17 Jul 1996 04:03:03 +0200

Bug #3807 caused xboard to dump core because it couldn't find the
fonts (Helvetica) it wanted.  A minimal fix would be to add
dependencies to xfnt100 and xfnt75, so that the required fonts
would always be available.  One of them would do, but it has to be
the one corresponding to the DPI setting of the server -- otherwise
xboard won't run in the default configuration.

Of course, it would also be nice if xboard didn't dump core upon
failing, and even nicer if it used a more flexible scheme when the
default font was not found.  The core dump happens in
DisplayFatalError() on line 3796 of xboard.c, because the
referenced widget pointer has not yet been initialized when the
function is called from main() via FindFont().  Also, if it weren't
for the core dump, xboard wouldn't exit when the "fatal" error had
been detected, but it would rather continue with the font it knows
doesn't exist, eventually leading to an Xlib error.

I have a feeling there are more bugs of this kind in xboard.

/RiW

---

From: Brian Mays <[email-masked]>
Date: Fri, 19 Jul 1996 19:04:42 -0400

>>>>> "Rickard" == Rickard Westman <[email-masked]> writes:

    Rickard> Bug #3807 caused xboard to dump core because it couldn't
    Rickard> find the fonts (Helvetica) it wanted.  A minimal fix
    Rickard> would be to add dependencies to xfnt100 and xfnt75, so
    Rickard> that the required fonts would always be available.  One
    Rickard> of them would do, but it has to be the one corresponding
    Rickard> to the DPI setting of the server -- otherwise xboard
    Rickard> won't run in the default configuration.

I've added a 'Recommends: xfnt100 | xfnt75' dependency to the control
file.  I don't think that 'Depends' is warranted, since XBoard can
still run when the Helvetica fonts are not available if it is told to
use another font -- either from a command line option or an X
resource.

    Rickard> Of course, it would also be nice if xboard didn't dump
    Rickard> core upon failing, and even nicer if it used a more
    Rickard> flexible scheme when the default font was not found.  The
    Rickard> core dump happens in DisplayFatalError() on line 3796 of
    Rickard> xboard.c, because the referenced widget pointer has not
    Rickard> yet been initialized when the function is called from
    Rickard> main() via FindFont().

I'll report this error to the upstream maintainers.  For now, I've
modified the XBoard program to print an error message to stderr and
exit instead of calling DisplayFatalError().  This eliminates the core
dump.

    Rickard> I have a feeling there are more bugs of this kind in
    Rickard> xboard.

Of that I have no doubt.  But all we can do is fix 'em when we find
'em.

--
Brian