This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: getaddrinfo() AI_IDN feature test


On Sun, 8 Mar 2015 09:29:14 -0400, Mike Frysinger wrote:
> On 01 Jan 2015 08:03, Martin Lambers wrote:
> > I recently changed two programs to use the AI_IDN flag for
> > getaddrinfo() instead of using libidn.
> > 
> > Users reported runtime failure (EAI_BADFLAGS) on systems where glibc
> > was build without libidn support.
> > 
> > On these systems, AI_IDN was defined nevertheless -- is this
> > intended behaviour? If so, then #ifdef AI_IDN is not enough; what
> > is the recommended way to check if AI_IDN actually works?
> 
> what version of glibc exactly ?  my reading of the git history is
> that since AI_IDN was added to the header for 2.4, glibc has
> unconditionally supported it. -mike

The glibc as shipped with AstLinux <http://www.astlinux.org>. I do not
have more information. Yes, AI_IDN is added unconditionally, but it
is only actually accepted when glibc is compiled with libidn. See
glibc-2.21/sysdeps/posix/getaddrinfo.c lines 2344-2347.

In msmtp we now do the following in configure.ac:
- Check if AI_IDN is defined.
- If so, check if it is supported by running a test program that
  resolves "localhost" with AI_IDN.
- Assume it works when cross-compiling, but provide an option
  --disable-gai-idn to override.

This does not yet support future getaddrinfo() implementations that
support IDN without requiring AI_IDN. For example, musl plans to do
this. And in my opinion it makes sense. AI_IDN should not exist, it
should simply be default behavior. 

Regards,
Martin

Attachment: pgpWSg9HRfa7m.pgp
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]