[Pkg-tcltk-devel] Bug#502304: Bug#502304: Tcl_Main should quit (exiting nonzero) if appInitProc fails

Sergei Golovan sgolovan at gmail.com
Sun Oct 18 07:23:25 UTC 2009

Hi Ian!

On Wed, Oct 15, 2008 at 4:21 PM, Ian Jackskon
<ijackson at chiark.greenend.org.uk> wrote:
> This report is regarding the error behaviour of:
>       Tcl_Main(int argc, char *argv[], Tcl_AppInitProc *appInitProc)
> with respect to appInitProc which has this type:
>       int Tcl_AppInit(Tcl_Interp *interp)
> The documentation says that appInitProc may return TCL_OK or _ERROR.
> The implication of TCL_ERROR is that the initialisation failed.  Under
> these conditions continuing to execute the program or shell is not
> appropriate.

I'm not sure that i isn't an intended behavior and appInitProc()
shouldn't call exit() itself if the failure is fatal. I've opened a
new bug in upstream bugtracker to collect opinions on this.

> As a demonstration:
>  mariner:~> DISPLAY=: wish
>  Application initialization failed: couldn't connect to display ":"
>  % mariner:~>
>  mariner:~> cat >t.tcl
>  vwait variable
>  mariner:~> DISPLAY=: wish -f t.tcl
>  Application initialization failed: couldn't connect to display ":"
>  [hangs]

These tests rather test Tk_Main() and not Tcl_Main(), but its behavior
is similar (though it doesn't exit when interpreter is deleted).

Sergei Golovan

More information about the Pkg-tcltk-devel mailing list