Overview
| Artifact ID: | 85f464e311d32ca5be6d12a992985b0c0e5c951a |
|---|---|
| Ticket: | 1618235fffffffffffffffffffffffffffffffff
tclUnixChan.c fails to compile on BSD |
| User & Date: | nobody on 2006-12-18 16:41:14 |
Changes
- assignee changed to: "hobbs"
- cmimetype changed to: "text/plain"
- comment changed to:
Tcl 8.4.14 Suse Linux 9.2 (running as a VMware Workstation 5.5.3 guest OS on a Windows XP Service Pack 2 host OS). > ./configure --enable-threads > make > make test ... ==== http-4.15 http::Event FAILED ... ---- Result was: 1 0 ---- Result should have been (exact matching): 11 When running "make test" with threads enabled (i.e. compiled with "-DTCL_THREADS=1 -DHAVE_GETHOSTBYNAME_R_6=1"), I get the above test failure. This does not happen with Tcl 8.5a6, as I'll explain later. The problem appears to stem from the behavior of gethostbyname_r() (see tcl/unix/tclUnixCompat.c line 589). For my version of Linux (Suse 9.2), gethostbyname_r() returns 0 for both valid and invalid URL's. However, the fifth parameter (struct hostent **RESULT) returns a NULL for invalid URL's. Therefore, a potential fix would be to change "&tsdPtr->hent" on line 591 to use the value returned by the fifth parameter "hePtr", e.g.: return (gethostbyname_r(name, &tsdPtr->hent, tstPtr->hbuf, sizeof(tsdPtr->hbuf), &hePtr, &h_errno) == 0) ? &tsdPtr->hent : NULL; should be: return (gethostbyname_r(name, &tsdPtr->hent, tstPtr->hbuf, sizeof(tsdPtr->hbuf), &hePtr, &h_errno) == 0) ? hePtr : NULL; This problem occurs in Tcl 8.4.14 when threads are enabled because tcl/unix/tclUnixChan.c:CreateSocketAddress() invokes the supposedly thread-safe function tcl/unix/tclUnixCompat.c:TclpGetHostByName(), which then invokes gethostbyname_r() if HAVE_GETHOSTBYNAME_R_6 is defined. This problem does not occur in Tcl 8.5a6 because tclUnixChan.c:CreateSocketAddress() was modified to call the potentially thread-unsafe gethostbyname() function, which may be another problem. Larry Wright [email protected] - foundin changed to: "obsolete: 8.4.14"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "29. http Package"
- title changed to: "http.test-4.15 http::Event FAILED"
- type changed to: "Bug"