Subject: bug#13958: Failing net-db.test on armv5tel glibc 2.17

From: Lluís Batlle i Rossell <[email-masked]>
Date: Fri, 15 Mar 2013 12:34:08 +0100

On Fri, Mar 15, 2013 at 12:14:21PM +0100, Ludovic Courtès wrote:
> Hi Lluís!
> 
> Lluís Batlle i Rossell <[email-masked]> skribis:
> 
> > running the test below, I see on glibc-2.17 armv5tel-linux:
> > ----
> > Running net-db.test
> >
> > ;;; (err -11)
> > unexpected error code: -11 "System error"
> > FAIL: net-db.test: getaddrinfo: no name
> > ----
> 
> Does it happen in a chroot without /etc/resolv.conf & co.?
> 
> Is it a dynamically-linked binary?
> 
> Could you run “strace -o log -f ./check-guile net-db.test” and post
> the log?
> 
> (Note that I build it with Guix on x86_64-linux-gnu without any
> problems; glibc 2.17 as well, and in a chroot.)
> 
> 
> Now, we have a problem with the ‘getaddrinfo-error’ API: EAI_SYSTEM
> means “check what errno says”, and we don’t provide the errno value.
> 
> This could be fixed by passing the errno as an additional parameter to
> ‘throw’.  However, that would lead to wrong-num-args for existing
> handlers upon EAI_SYSTEM, and would essentially force programmers to use
> ‘case-lambda’ for their handlers.
> 
> OTOH, there are only two occurrences of EAI_SYSTEM in inet/getaddrinfo.c
> in glibc: one is for NETDB_INTERNAL, and the other is for
> IDNA_DLOPEN_ERROR.  When that happens, the extra bit of information
> provided by errno is probably not very helpful.

I think this log should be enough. I have a dns server at 127.0.0.1,
and I have in nix.conf:
build-use-chroot = false

Excerpt of the strace log:
16993 connect(7, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
16993 gettimeofday({1363270208, 638948}, NULL) = 0
16993 poll([{fd=7, events=POLLOUT}], 1, 0) = 1 ([{fd=7, revents=POLLOUT}])
16993 sendmmsg(7, {{{msg_name(0)=NULL, msg_iov(1)=[{"\25>\1\0\0\1\0\0\0\0\0\0\16does-not-exist\10ho
me"..., 45}], msg_controllen=0, msg_flags=MSG_WAITALL|MSG_TRUNC|MSG_DONTWAIT|MSG_RST|MSG_NOSIGNAL|M
SG_MORE|0xbed40000}, 45}, {{msg_name(0)=NULL, msg_iov(1)=[{"\303:\1\0\0\1\0\0\0\0\0\0\16does-not-ex
ist\10home"..., 45}], msg_controllen=0, msg_flags=0}, 45}}, 2, MSG_NOSIGNAL) = 2
16993 poll([{fd=7, events=POLLIN}], 1, 5000) = 1 ([{fd=7, revents=POLLIN}])
16993 ioctl(7, FIONREAD, [106])         = 0
16993 recvfrom(7, "\25>\201\203\0\1\0\0\0\1\0\0\16does-not-exist\10home"..., 2048, 0, {sa_family=AF
_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [16]) = 106
16993 gettimeofday({1363270208, 645244}, NULL) = 0
16993 poll([{fd=7, events=POLLIN}], 1, 4993) = 1 ([{fd=7, revents=POLLIN}])
16993 ioctl(7, FIONREAD, [106])         = 0
16993 recvfrom(7, "\303:\201\203\0\1\0\0\0\1\0\0\16does-not-exist\10home"..., 1940, 0, {sa_family=A
F_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [16]) = 106
16993 close(7)                          = 0
16993 gettimeofday({1363270208, 646679}, NULL) = 0
16993 gettimeofday({1363270208, 646897}, NULL) = 0
16993 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 7
16993 connect(7, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
16993 gettimeofday({1363270208, 647559}, NULL) = 0
16993 poll([{fd=7, events=POLLOUT}], 1, 0) = 1 ([{fd=7, revents=POLLOUT}])
16993 sendmmsg(7, {{{msg_name(0)=NULL, msg_iov(1)=[{"\332\330\1\0\0\1\0\0\0\0\0\0\16does-not-exist\
0\0\1\0\1", 32}], msg_controllen=0, msg_flags=MSG_WAITALL|MSG_TRUNC|MSG_DONTWAIT|MSG_RST|MSG_NOSIGN
AL|MSG_MORE|0xbed40000}, 32}, {{msg_name(0)=NULL, msg_iov(1)=[{"\313w\1\0\0\1\0\0\0\0\0\0\16does-no
t-exist\0\0\34\0\1", 32}], msg_controllen=0, msg_flags=0}, 32}}, 2, MSG_NOSIGNAL) = 2
16993 poll([{fd=7, events=POLLIN}], 1, 5000) = 1 ([{fd=7, revents=POLLIN}])
16993 ioctl(7, FIONREAD, [107])         = 0
16993 recvfrom(7, "\332\330\201\203\0\1\0\0\0\1\0\0\16does-not-exist\0\0\1\0\1"..., 2048, 0, {sa_fa
mily=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [16]) = 107
16993 gettimeofday({1363270208, 651397}, NULL) = 0
16993 poll([{fd=7, events=POLLIN}], 1, 4996) = 1 ([{fd=7, revents=POLLIN}])
16993 ioctl(7, FIONREAD, [107])         = 0
16993 recvfrom(7, "\313w\201\203\0\1\0\0\0\1\0\0\16does-not-exist\0\0\34\0\1"..., 1940, 0, {sa_fami
ly=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [16]) = 107
16993 close(7)                          = 0
16993 open("/nix/store/83fff5psdwad2vcy44lv5gwyzfmj4433-glibc-2.17/lib/libnss_myhostname.so.2", O_R
DONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
16993 write(1, "\n", 1)                 = 1
16993 write(1, ";;; ", 4)               = 4
16993 write(1, "(", 1)                  = 1
16993 write(1, "err", 3)                = 3
16993 write(1, " ", 1)                  = 1
16993 write(1, "-11", 3)                = 3
16993 write(1, ")", 1)                  = 1
16993 write(1, "\n", 1)                 = 1
16993 write(1, "unexpected error code: ", 23) = 23

Regards,
Lluís.