all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: guix-devel@gnu.org
Subject: Re: Neon and reverse address lookup
Date: Sat, 18 Jan 2014 21:09:13 +0100	[thread overview]
Message-ID: <87mwitqcgm.fsf@gnu.org> (raw)
In-Reply-To: <87zjmtpd2t.fsf@netris.org> (Mark H. Weaver's message of "Sat, 18 Jan 2014 09:41:14 -0500")

Mark H Weaver <mhw@netris.org> skribis:

> Andreas Enge <andreas@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’.

  parent reply	other threads:[~2014-01-18 20:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-18 12:48 Neon and reverse address lookup Andreas Enge
2014-01-18 14:17 ` John Darrington
2014-01-18 14:43   ` Mark H Weaver
2014-01-18 14:41 ` Mark H Weaver
2014-01-18 16:45   ` Andreas Enge
2014-01-18 16:48     ` John Darrington
2014-01-18 20:59       ` Ludovic Courtès
2014-01-18 20:09   ` Ludovic Courtès [this message]
2014-01-18 21:32 ` Ludovic Courtès
2014-01-18 21:49   ` John Darrington
2014-01-18 21:55   ` Mark H Weaver
2014-01-19 15:40     ` Ludovic Courtès
2014-02-05 17:30       ` Andreas Enge
2014-02-05 20:07         ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwitqcgm.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.