Tcl Source Code

View Ticket
Login
Ticket UUID: 767676
Title: Patch for failing tests
Type: Patch Version: None
Submitter: hgiese Created on: 2003-07-08 11:08:32
Subsystem: 25. Channel System Assigned To: davygrvy
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-10-27 03:29:13
Resolution: Fixed Closed By: davygrvy
    Closed on: 2004-10-26 20:29:13
Description:
Hello out there,
on Win98 there are 4 failing tests in winpipe.test (not
Borland specific). They all follow this pattern:

==== winpipe-4.2 Tcl_WaitPid: return of exception
codes, SIGFPE FAILED
==== Contents of test case:

    set f [open "|[tcltest::interpreter]" w+]
    set pid [pid $f]
    puts $f "testexcept float_underflow"
    set status [catch {close $f}]
    list $status [expr {$pid == [lindex $::errorCode
1]}] [lindex $::errorCode 2]

---- Result was:
1 0 SIGFPE
---- Result should have been (exact matching):
1 1 SIGFPE

The reason:
- On Win9x PIDs are *large* values (like 0xFFFFhhhh)
- TclCleanupChildren() (in tclpipe.c) uses
TclFormatInt() to convert the PID to a string,
resulting in something like -5432.
- [pid ...] aparently returns an unsigned int (or its
string equivalent)
- and the test on equality fails.

The patch proposes to do instead (see the attached diff
file)

#ifdef __WIN32__
        sprintf(msg1, "%lu", resolvedPid);
#else
        TclFormatInt(msg1, (long) resolvedPid);
#endif

(and the equivalent for msg2).

I used a conditional __WIN32__, however it seems to me
that on *any* platform the PID should be considered
unsigned, so IMHO there is no need for a conditional.
Best regards
Helmut Giese
User Comments: davygrvy added on 2004-10-27 03:29:13:
Logged In: YES 
user_id=7549

fixed. committed to HEAD

andreas_kupries added on 2004-10-27 02:20:05:
Logged In: YES 
user_id=75003

David, does this make sense ?

hgiese added on 2003-07-08 18:08:32:

File Added - 55236: tclPipe_c.diff

Attachments: