#1011914 lsof: FTBFS during unit tests when hostname cannot be resolved

Package:
src:lsof
Source:
lsof
Submitter:
Lucas Nussbaum
Date:
2022-06-05 17:06:03 UTC
Severity:
minor
Tags:
#1011914#5
Date:
2022-05-26 19:09:16 UTC
From:
To:
Hi,

During a rebuild of all packages in sid, your package failed to build
on amd64.


Relevant part (hopefully):
The full build log is available from:
http://qa-logs.debian.net/2022/05/25/lsof_4.95.0-1_unstable.log

All bugs filed during this archive rebuild are listed at:
https://bugs.debian.org/cgi-bin/pkgreport.cgi?tag=ftbfs-20220525;users=lucas@debian.org
or:
https://udd.debian.org/bugs/?release=na&merged=ign&fnewerval=7&flastmodval=7&fusertag=only&fusertagtag=ftbfs-20220525&fusertaguser=lucas@debian.org&allbugs=1&cseverity=1&ctags=1&caffected=1#results

A list of current common problems and possible solutions is available at
http://wiki.debian.org/qa.debian.org/FTBFS . You're welcome to contribute!

If you reassign this bug to another package, please marking it as 'affects'-ing
this package. See https://www.debian.org/Bugs/server-control#affects

If you fail to reproduce this, please provide a build log and diff it with mine
so that we can identify if something relevant changed in the meantime.

#1011914#10
Date:
2022-06-04 19:13:35 UTC
From:
To:
Thanks for the report. I can't reproduce this, though.

The code in question is this:


/*
 * Get the host name and its IP address.  Convert the IP address to
dotted
 * ASCII form.
 */
    if (gethostname(hnm, sizeof(hnm) - 1)) {
        cem = "ERROR!!!  can't get this host's name";
        goto print_errno;
    }
    hnm[sizeof(hnm) - 1] = '\0';
    if (!(hp = gethostbyname(hnm))) {
        (void) snprintf(buf, bufl - 1, "ERROR!!!  can't get IP address
for %s",
            hnm);
        buf[bufl - 1] = '\0';


It seems like gethostbyname() is failing, which presumably is a
misconfiguration on the part of the build host (probably something in
/etc/hosts?). I'm pretty sure local hostname forward and reverse
lookups don't violate policy 4.9 "required targets must not attempt
network access, except, via the loopback interface", but correct me if
I'm wrong.

I've attached the build log and the diff between our build logs, just
in case that's helpful (although you're using sbuild and I'm not, so
the diff isn't very readable).
[...]

#1011914#15
Date:
2022-06-05 09:13:36 UTC
From:
To:
Hi Andres,
check against this, so even if it did require network access, the build
would work just fine).

What happens in AWS is:
- the hostname is ip-10-84-234-245 (for example)
- /etc/hosts contains (on the host)
   127.0.1.1 ip-10-84-234-245.eu-central-1.compute.internal ip-10-84-234-245
- schroot does not copy the host's /etc/hosts to the chroot, because the
  chroot is configured (using sbuild-create-chroot) to use the 'sbuild'
  schroot profile, which does not include 'hosts' in
  /etc/schroot/sbuild/nssdatabases

As a result, if the hostname cannot be resolved using DNS but only using
NSS (/etc/hosts), then it cannot be resolved inside the chroot.

I fixed my chroot setup script so that 'hosts' get copied from host, and
confirmed that lsof now builds fine.

I let you decide whether you want to close this bug, or turn it into a
severity:minor "FTBFS when hostname cannot be resolved".

I am not aware of other packages failing to build in the AWS environment
because of this issue, so it might be worth keeping track of with a bug.

Lucas

#1011914#20
Date:
2022-06-05 16:47:41 UTC
From:
To:
severity 1011914 minor
tags 1011914 = wontfix
retitle 1011914 lsof: FTBFS during unit tests when hostname cannot be
resolved
forward 1011914 https://github.com/lsof-org/lsof/issues/61
thanks
[...]


Thanks, I'll keep it open. We have an upstream bug[0] discussing what to
do about the unit tests, which may result in the tests not being run at
all. If that ends up being the case, I will of course close this.

[0] https://github.com/lsof-org/lsof/issues/61#issuecomment-1120611271