News for hackers. Stuff that matters.
Re:Go Memory Management by e12e on Monday August 20, 2018 @07:01PM (#17804901)
> Almost any linux machine's `/etc/nsswitch.conf` will contain features that the go resolver doesn't implement.

Do you know of a short list of top features missing? I would kinda hope that modern and generally useful features would be in netgo. And old rotted code, security risks and anachronisms would be abandoned. But from your tone, I gather that this is more than a "people only use 10%, but never the same 10%" type of thing?

Re:Go Memory Management by TheDong on Tuesday August 21, 2018 @12:28AM (#17806991)
Here's the code that determines if it needs to fall back to cgo: https://github.com/golang/go/blob/161874da2ab6d5372043a1f393...

Notably, it can only handle the following sources: files, dns, myhostname, mdns* (but only a subset of those if you read the gory details).

It doesn't handle the fairly uncommon "mymachines" or "resolve" (sometimes used in the systemd world nowadays)

I probably spoke too pessimistically there. Many machines won't have an nsswitch.conf that requires using cgo for common domains. After re-reading the code, it does handle more than I thought (mainly mdns).

> I would kinda hope that modern and generally useful features would be in netgo. And old rotted code, security risks and anachronisms would be abandoned

The fundamental problem here is not that. The nss system libc uses for network resolution is a pluggable system, and it chose dynamically linked c modules as its plugins.

It's not that they're old rotted insecure bits of code, it's that the interface is inherently a c-centric one, and go early on decided it wished to do syscalls directly instead of call them through libc (as literally every other programming language does).

Finally, that means go can't ever reach full parity as long as it wishes to avoid c, since anyone can simply write a new nss plugin in c and list it in resolv.conf, and go has no way of having that same arbitrary behaviour in go.

Re:Go Memory Management by e12e on Tuesday August 21, 2018 @02:47AM (#17807564)
Thank you for taking the time to reply.

> that means go can't ever reach full parity as long as it wishes to avoid c

Well, go has for better or worse decided on a "we'll bring our own batteries" approach - and that does imply a burden of re-inventing a lot of wheels. On the other hand, those wheels are all likely to be painted in just the right shade of gopher brown.

At a glance, nis/yp appear to be missing. Not sure if nis doesn't count as outdated though.