Subject: bug#58520: Persistent failure to DNS-lookup hostname

From: Stefan Monnier <[email-masked]>
Date: Mon, 18 Dec 2023 13:26:59 -0500

>> IOW, `res_init` only affects the running program.
> I didn't know that, sorry.  (I didn't know DNS can affect a single
> program.)

Basically, when the libc library parses the `/etc/resolv.conf` file to
figure out the IP address of the DNS server, it stores the result in
a local variable so as to speed up later DNS requests.
`res_init` forces it to reset that var.

It used to be indispensable to call it "all the time", but nowadays
glibc normally detects on its own when it needs to re-read
`/etc/resolv.conf`.

Except that in some weird corner case that Visuwesh and I are bumping
into, the "normally" fails to apply.  It's presumably a bug somewhere in
libc or in Emacs (or in some other library we use).

> If we want something like that in Emacs, we should probably find a
> more portable way of doing it.

I only used it to confirm the diagnostic, as well as as a crutch to
workaround the problem until it gets fixed.  So far I have not
considered including it in Emacs proper.

        Stefan