Tcl Source Code

View Ticket
Login
2019-10-02
13:40 Closed ticket [9146698599]: NetBSD's gethostbyname_r() incompatible with Tcl usage plus 5 other changes artifact: 44c50ea2c9 user: krytarowski
2017-05-29
15:30 Ticket [9146698599]: 3 changes artifact: 7764c10e05 user: emiliano
2016-07-26
10:13 Ticket [9146698599]: 3 changes artifact: bd24831039 user: gustafn2
10:04 Add attachment tcl86-gethostbyaddr.patch to ticket [9146698599] artifact: a793c53f80 user: gustafn2
2016-07-21
12:20 Ticket [9146698599] NetBSD's gethostbyname_r() incompatible with Tcl usage status still Open with 3 other changes artifact: ab5d7a06ad user: gustafn2
12:13 Ticket [9146698599]: 3 changes artifact: 0e4f2e16ef user: gustafn2
2016-07-09
08:40 Ticket [9146698599]: 4 changes artifact: b673e41064 user: dkf
08:37 Ticket [9146698599]: 3 changes artifact: 4281739fd0 user: dkf
2016-07-07
12:57 Ticket [9146698599]: 3 changes artifact: 08d2659275 user: emiliano
2015-11-02
11:29 Ticket [9146698599]: 3 changes artifact: 090628fbc9 user: emiliano
2015-11-01
21:35 Add attachment nbsd_gethostbyname.diff to ticket [9146698599] artifact: 438f049396 user: emiliano
21:35 New ticket [9146698599] NetBSD's gethostbyname_r() incompatible with Tcl usage. artifact: 5fb0df8e65 user: emiliano

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

Attachments: