From: Omar Polo Subject: Re: smtpd: spell HOST_NAME_MAX differently (for -portable) To: Florian Obser Cc: tech@openbsd.org, gilles@poolp.org Date: Tue, 20 Aug 2024 15:36:45 +0200 On 2024/08/20 14:49:06 +0200, Florian Obser wrote: > On 2024-08-20 12:40 +02, Omar Polo wrote: > > in -portable land there's an issue on glibc-based systems because > > HOST_NAME_MAX is set at 64. We end up truncating longer names and this > > makes checks like fcrdns fails. > > > > In the spirit of reducing the number of portable only changes to carry, > > would something like this be acceptable for base? An alternative would > > be to use _POSIX_HOST_NAME_MAX instead. > > > > The diff is mostly by Romain Petit via[0] adapted for base. > > [0]: > > > > Thoughts? > > I think they should fix their libc. I think so too > posix has this to say: > > {HOST_NAME_MAX} > Maximum length of a host name (not including the terminating null) as returned from the gethostname() function. > Minimum Acceptable Value: {_POSIX_HOST_NAME_MAX} > > {_POSIX_HOST_NAME_MAX} > Maximum length of a host name (not including the terminating null) as returned from the gethostname() function. > Value: 255 Yep, but I'm not sure they'll fix their libc anytime soon, so we'll have to cope in -portable one way or another. :/ Their gethostname(2) manpage in the VERSIONS section explains that HOST_NAME_MAX has been 64 since linux 1.0 (and before was even lower) so I guess they know and won't do anything. See the beautiful "This limit is imposed by the Linux kernel" (and fwiw musl does the right thing.)