Tcl Source Code

View Ticket
Login
Ticket UUID: 2529137
Title: tcl core dumps when exec'd program exits with a signal
Type: Bug Version: None
Submitter: jkfellin Created on: 2009-01-22 18:47:11
Subsystem: 24. Channel Commands Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2009-03-19 01:52:38
Resolution: Invalid Closed By: sf-robot
    Closed on: 2009-03-18 18:52:38
Description:
This occurs in tcl8.5.6, in porting to UWIN running on a i686 platform. The expected behavior is tclsh should not core dump when an exec'd command exits with a signal.

When a process started by the exec command terminates with a signal, tcl core dumps by referencing the wait status as a pointer to a string. 
The problem code is in generic/tclPipe.c:TclCleanupChildren line 331 
  Tcl_AppendResult(interp, "child killed: ", p, " waitstatus x%x\n", waitStatus, NULL);

I've corrected the problem by changing the above code to the following:

sprintf(msg2, "x%4.4x\n", waitStatus);
Tcl_AppendResult(interp, "child killed: ", p, "waitstatus ", msg2, NULL);
User Comments: sf-robot added on 2009-03-19 01:52:38:

allow_comments - 1

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

andreas_kupries added on 2009-01-23 02:26:49:
More questions.
Looking at the CVS head of Tcl 8.5, file generic/tclPipe.c, rev 1.19) I do not find the code you are refering too.

Grepping through the cvs heads of 8.[456] the phrase 'waitstatus x' is nowhere found.
Goinf for 'child killed:' I find
andreask@gila:~/activetcl/dbn/night> grep -rn 'child killed:' ~/lsf/tcl-8.[456]
/home/andreask/lsf/tcl-8.4/generic/tclPipe.c:341:                    Tcl_AppendResult(interp, "child killed: ", p, "\n",
/home/andreask/lsf/tcl-8.5/generic/tclPipe.c:332:                    Tcl_AppendResult(interp, "child killed: ", p, "\n", NULL);
/home/andreask/lsf/tcl-8.6/generic/tclPipe.c:332:                   Tcl_AppendResult(interp, "child killed: ", p, "\n", NULL);

and none of these places use waitStatus in the manner you describe.

What revision is your file ? (Look at the RCS: comment at the top).

andreas_kupries added on 2009-01-23 02:19:54:
I am a bit unclear on the platform reported.
What is UWIN ?

jkfellin added on 2009-01-23 01:47:11:

File Added - 310214: tclPipe.diff

Attachments: