[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Neon and reverse address lookup

From: Ludovic Courtès
Subject: Re: Neon and reverse address lookup
Date: Sat, 18 Jan 2014 21:09:13 +0100
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Mark H Weaver <address@hidden> skribis:

> Andreas Enge <address@hidden> writes:
>> when trying to package the neon library:
>> ,
>> the tests fail inside the chroot with
>>    addr_reverse (reverse lookup for 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/ reads this:

      /* Create /etc/hosts with localhost entry. */
      writeFile(chrootRootDir + "/etc/hosts", " 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]