Ticket UUID: | 91466985995db6b505c415322b8090a5754f2dc3 | |||
Title: | NetBSD's gethostbyname_r() incompatible with Tcl usage | |||
Type: | Bug | Version: | trunk | |
Submitter: | emiliano | Created on: | 2015-11-01 21:35:28 | |
Subsystem: | 52. Portability Support | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Critical | |
Status: | Closed | Last Modified: | 2019-10-02 13:40:40 | |
Resolution: | None | Closed By: | krytarowski | |
Closed on: | 2019-10-02 13:40:40 | |||
Description: |
On NetBSD, gethostbyname_r is detected but the function is incompatible with Tcl usage, so at least on NetBSD-7 [info hostname] crashes. Attached patch solves the issue. | |||
User Comments: |
krytarowski added on 2019-10-02 13:40:40:
Fixed with https://core.tcl-lang.org/tcl/info/16768d65f0 emiliano added on 2017-05-29 15:30:34: From a fresh update of Tcl trunk (2017-05-29), compiled with default options: % info hostname cabernet.vinotinto.com.ar % info patchlevel 8.7a0 % uname -a NetBSD cabernet.vinotinto.com.ar 7.1 NetBSD 7.1 (GENERIC.201703111743Z) i386 So this ticket can be closed. The issue of using non-standard interfaces (gethostbyname_r) when a standard one can be used (getaddrinfo) should be addressed to avoid reintroducing these type of bugs gustafn2 added on 2016-07-26 10:13:03: I've added a patch replacing all occurrences of gethostbyname_r() by an appropriate call of getaddrinfo(). Actually, the definition of TclpGetHostByName() could/should be dropped, when HAVE_GETADDRINFO is defined (i am not sure, what the policy in tcl-core concerning Tclp* calls is). I would recommend to drop TclpGetHostByName(), since this returns a partial struct hostent, which makes mostly sense in connection with gethostbyname*(). gustafn2 added on 2016-07-21 12:20:09: ... we do this in NaviServer, see e.g. bitbucket/naviserver/nsd/dns.c#372 gustafn2 added on 2016-07-21 12:13:57: my 5ct: i would think that in cases, where HAVE_GETADDRINFO is defined, one should use getaddrinfo() instead of gethostbyname*(). If there are really systems in use, which do not HAVE_GETADDRINFO, these can fallback to the GETHOSTBYNAME machinery. dkf added on 2016-07-09 08:40:30: By which I mean "why don't we switch to using getaddrinfo() there as well as for actually creating sockets?" After all, we've already got the machinery largely there in tclIOSock.c... dkf added on 2016-07-09 08:37:26: Is there a reason for that platform not using getaddrinfo()? emiliano added on 2016-07-07 12:57:36: More evidence that gethostbyname_r() is unsupported on NetBSD: http://mail-index.netbsd.org/netbsd-users/2016/06/30/msg018651.html |