Your message dated Sat, 18 Oct 2014 16:00:19 +0200
with message-id <[email protected]>
and subject line Tcl_Main should quit (exiting nonzero) if appInitProc fails
has caused the Debian Bug report #502304,
regarding Tcl_Main should quit (exiting nonzero) if appInitProc fails
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
502304: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502304
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: tcl8.4
Version: 8.4.12-1.1
Tags: patch

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.

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]
Similar behaviour will appear with any program which uses Tcl_Main and
has an appInitProc which can fail.  (Obviously the test cases above
are simple tests, but a more complicated program involving vwait is
quite conceivable.)

The code in Tcl_Main seems to suggest that if the appInitProc were to
call Tcl_DeleteInterp, the execution would be safely abandoned.  But
this is a quite unreasonable thing to expect the appInitProc hook to
do and is not documented.  In any case if the appInitProc merely wants
to issue a warning and carry on it can do so itself.  The exit code
should be reserved for ordinary (fatal) errors.

I think this patch will fix it but I haven't compiled or tested it.

--- generic/tclMain.c~  2005-10-23 23:01:30.000000000 +0100
+++ generic/tclMain.c   2008-10-15 13:18:39.000000000 +0100
@@ -281,6 +281,8 @@
            Tcl_WriteObj(errChannel, Tcl_GetObjResult(interp));
            Tcl_WriteChars(errChannel, "\n", 1);
        }
+       exitCode = 1;
+       goto done;
     }
     if (Tcl_InterpDeleted(interp)) {
        goto done;

--



--- End Message ---
--- Begin Message ---
See my previous message.

-- 
Stéphane Aulery

--- End Message ---
_______________________________________________
Pkg-tcltk-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-tcltk-devel

Reply via email to