Mark H Weaver <m...@netris.org> skribis: > Andreas Enge <andr...@enge.fr> writes: > >> when trying to package the neon library: >> http://www.webdav.org/neon/ , >> the tests fail inside the chroot with >> addr_reverse (reverse lookup for 127.0.0.1 failed) >> >> Should I disable the corresponding test? > > I think we should include /etc/hosts in the chroot with an entry for > localhost. We might also need /etc/nsswitch.conf; I'm not sure. I see > no reason not to do this, and I suspect it would ultimately take less > time and effort than disabling tests.
Actually, I just discovered that it’s been the case since before Guix was even started. :-) nix/libstore/build.cc reads this: /* Create /etc/hosts with localhost entry. */ writeFile(chrootRootDir + "/etc/hosts", "127.0.0.1 localhost\n"); So lookups of ‘localhost’ should just work. To make sure this is the case, try this: --8<---------------cut here---------------start------------->8--- #!/path/to/bin/guile -s !# (use-modules (guix) (guix monads)) (define (with-/etc/hosts?) (define b '(and (file-exists? "/etc/hosts") (getaddrinfo "localhost") (call-with-output-file (assoc-ref %outputs "out") (const #t)))) (mlet* %store-monad ((d (derivation-expression "etc-hosts" b))) (built-derivations (list d)))) (let* ((s (open-connection))) (run-with-store s (with-/etc/hosts?))) --8<---------------cut here---------------end--------------->8--- I don’t think nsswitch.conf will be necessary. Thanks, Ludo’.