unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Andreas Enge <andreas@enge.fr>
Cc: guix-devel@gnu.org
Subject: Re: Neon and reverse address lookup
Date: Sat, 18 Jan 2014 22:32:31 +0100	[thread overview]
Message-ID: <8738klou1c.fsf@gnu.org> (raw)
In-Reply-To: <20140118124847.GA6166@debian> (Andreas Enge's message of "Sat, 18 Jan 2014 13:48:47 +0100")

Andreas Enge <andreas@enge.fr> skribis:

> 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)

I just tried this and it fails with “Host name lookup failure”:

--8<---------------cut here---------------start------------->8---
#!/.../bin/guile -s
!#

(use-modules (guix) (guix monads))

(define (with-/etc/hosts?)
  (define b
    '(and (file-exists? "/etc/hosts")
          (pk 'gethostbyaddr
              (hostent:name (gethostbyaddr
                             (inet-pton AF_INET
                                        "127.0.0.1"))))
          (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---

So /etc/hosts is not enough for reverse lookups to work.

With nscd turned off, I tried this:

  guile -c '(pk (gethostbyaddr (inet-pton AF_INET "127.0.0.1")))'

If nsswitch.conf is removed, then that resolves to “localhost” (instead
of the actual host name.)

If, in addition, resolv.conf is removed, then that fails as seen above.

With nsswitch.conf alone, it resolves correctly (Mark was right.)
And this works with only “hosts: files” in nsswitch.conf.

It’s surprising that there’s this discrepancy between how NSS works for
getaddrinfo and for gethostbyaddr.  At any rate, we may be able to solve
this at the libc level.

Thanks,
Ludo’.

  parent reply	other threads:[~2014-01-18 21:37 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
2014-01-18 21:32 ` Ludovic Courtès [this message]
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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=8738klou1c.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=andreas@enge.fr \
    --cc=guix-devel@gnu.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).