bug-xboard
[Top][All Lists]
Advanced

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

[Bug-XBoard] xboard crashes when not invoked from shell


From: h.g. muller
Subject: [Bug-XBoard] xboard crashes when not invoked from shell
Date: Mon, 15 Dec 2008 09:42:22 +0100

Hi,

We stumbled on a nasty bug in xboard: when xboard was started up by a tournament manager (in particular PSWBTM), rather than from the command line, it failed to work properly: the engine
it started up would always terminate immediatey after its own initialization.

We could trace the problem to the xboard code for setting up the pipes between GUI and engine. This code is not resistent to file descriptors 0 or 1 being initially closed. Ans some software packages, including the wxWidgets on which PSWBTM was based, close all unused file descriptors on executing another program. So when launched from PSWBTM, xboard was started with file
descriptor 1 closed.

The code of 4.2.7 first creates the pipes (which will obtain the lowest-available file descriptors), then duplicates them to 0 and 1, then closes the original pipe descriptors. But if 1 was amongst the
latter, it means one of the newly setup pipes is closed again.

In xboard 4.3.15 (the upcoming release in my own development branch) I have fixed this by moving the close() calls for the unused pipe ends to before the dup2() calls. In the closing of the original pipe descriptors after duplication one has to be more careful, and only close them if they are >= 2. As expected, this cures the problem, and make xboard run under PSWBTM on Linux like WinBoard
does on Windows. (PSWBTM is platform independent.)

Regards,
H.G.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]