Skip to content

aarch64 msys2-runtime: getaddrinfo fails on numeric addresses and hangs on names #6

Description

@aswin-mcw

Summary

getaddrinfo() does not work on the aarch64 msys2-runtime. It fails on an
address that requires no lookup at all, and hangs indefinitely when given a
hostname. gethostbyname() on the same runtime resolves the numeric case
correctly, so this is specific to getaddrinfo.

Reproduction

struct addrinfo hints, *ai = 0;
memset(&hints, 0, sizeof hints);
hints.ai_flags    = AI_NUMERICHOST;
hints.ai_family   = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
int e = getaddrinfo("127.0.0.1", 0, &hints, &ai);
$ ./t.exe
  calling getaddrinfo(127.0.0.1, numeric=1)... rc=11 (System error) ai=0x0
  calling getaddrinfo(localhost, numeric=0)...        <- never returns

rc=11 is EAI_SYSTEM. AI_NUMERICHOST with a dotted-quad address cannot
require any name service, so this should not be able to fail. The second call
had to be killed with taskkill.

For contrast, on the same runtime:

gethostbyname(127.0.0.1) -> 127.0.0.1

Impact

Anything doing hostname resolution. It is also visible at build time, because
configure scripts probe it and get a truthful "no":

checking if getaddrinfo seems to work... no

curl 8.21 then refuses to build with IPv6 enabled at all -

error "Unexpected build: IPv6 is enabled but getaddrinfo was not found."
  • so cross-msysarm64-curl has to be configured --disable-ipv6, which selects
    its gethostbyname resolver. That workaround should be reverted once this is
    fixed.

Note the older curl 8.15.0 used by the earlier standalone build scripts had no
such check: it configured IPv6 on and resolved through gethostbyname anyway,
which is why this went unnoticed until the newer release surfaced it.

Related

Very likely the same underlying problem as the socket() segfault reported
separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: hardCompiler or runtime internals; cause not yet isolatedpriority: highBlocks packages, or the workaround is fragile

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions