[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: HOST_NAME_MAX
From: |
Simon Josefsson |
Subject: |
Re: HOST_NAME_MAX |
Date: |
Tue, 11 Aug 2009 18:19:29 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Simon Josefsson wrote:
>> Then I'm less sure that it makes sense for
>> gnulib's limit.h to define HOST_NAME_MAX -- programs written against
>> POSIX should not assume that symbol exists.
>
> On the other hand, the support of POSIX for unspecified maximum host
> name lengths is weak: You see in [1] that
> - when the host name is longer than namelen, the string is truncated,
> possibly NUL terminated or not,
> - when gethostname fails, it is unspecified whether it sets errno.
> The reality (see lib/xgethostname.c) is even worse:
> - when the host name is longer than namelen, then some platforms
> return -1, others don't; some platforms even write past the specified
> namelength bytes,
> - the errnos appearing in this case are far from standard.
>
> I think it's a favour that gnulib can do to its users, to not force
> developers to deal with these pitfalls.
>
> And don't tell me that host names longer than 256 bytes occur frequently :-)
Thanks, your arguments are compelling and useful to have archived in
case some FreeBSD people thinks we are making things worse by
re-introducing the HOST_NAME_MAX symbol that they appear to want to get
rid of.
I guess to really get rid of the symbol, improving the POSIX
specification in this area would be useful -- however it may be hard
since deployed implementations differ.
>> Do sysconf work under mingw? Gnulib could provide a replacement if not.
>
> That would be some work, because of the many arguments that sysconf
> should support. [2]
It is a large number of symbols, but I wonder how many of them actually
are difficult to quantify.
/Simon
- Re: HOST_NAME_MAX, Bruno Haible, 2009/08/02
- Re: HOST_NAME_MAX, Bruno Haible, 2009/08/02
- Re: HOST_NAME_MAX, Tom G. Christensen, 2009/08/06
- Re: HOST_NAME_MAX, Simon Josefsson, 2009/08/06
- Re: HOST_NAME_MAX, Bruno Haible, 2009/08/08
- Re: HOST_NAME_MAX, Simon Josefsson, 2009/08/10
- Re: HOST_NAME_MAX, Bruno Haible, 2009/08/10
- Re: HOST_NAME_MAX, Simon Josefsson, 2009/08/10
- Re: HOST_NAME_MAX, Bruno Haible, 2009/08/10
- Re: HOST_NAME_MAX,
Simon Josefsson <=
Re: HOST_NAME_MAX, Simon Josefsson, 2009/08/03