guix-devel
[Top][All Lists]
Advanced

[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 22:32:31 +0100
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

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



reply via email to

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