[Debian-ha-maintainers] Bug#895179: booth tests wrongly assume hostname maps to an interface IP

Steve Langasek steve.langasek at canonical.com
Sun Apr 8 08:36:44 BST 2018


Package: booth
Version: 1.0-6
Severity: minor
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch autopkgtest

Dear maintainers,

With the upload of booth 1.0-6, the booth autopkgtests are failing in Ubuntu
because the upstream tests are broken for the Ubuntu environment.  The tests
generate a config file which hard-codes an IP address taken from `hostname
-i`; however, by default on an Ubuntu system `hostname -i` will map to
127.0.1.1, an IP address that works perfectly well for connections on the
loopback device but which does *not* show up as a configured IP address
according to netlink, causing booth to fail to start.

I think this is simply a bug in the tests; the test harness is making an
invalid assumption and encoding an IP address into the config that it should
not, and that no actual user would be trying to use.

The attached patch corrects this by simply always using 127.0.0.1 in the
tests.

I have uploaded this patch to Ubuntu to allow the new version of the booth
package to be included in the Ubuntu release.  Please consider applying it
in Debian as well.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru booth-1.0/debian/patches/series booth-1.0/debian/patches/series
--- booth-1.0/debian/patches/series	2018-01-29 12:32:49.000000000 -0800
+++ booth-1.0/debian/patches/series	2018-04-08 00:28:38.000000000 -0700
@@ -1,3 +1,4 @@
 gcc-7-buffer-size.patch
 fix-failing-unit-tests.patch
 spelling.patch
+wrong-local-ip-assumption-in-tests.patch
diff -Nru booth-1.0/debian/patches/wrong-local-ip-assumption-in-tests.patch booth-1.0/debian/patches/wrong-local-ip-assumption-in-tests.patch
--- booth-1.0/debian/patches/wrong-local-ip-assumption-in-tests.patch	1969-12-31 16:00:00.000000000 -0800
+++ booth-1.0/debian/patches/wrong-local-ip-assumption-in-tests.patch	2018-04-08 00:28:31.000000000 -0700
@@ -0,0 +1,24 @@
+Description: don't assume `hostname` must map to a configured IP
+ On Ubuntu systems, by default, `hostname -i` will point to 127.0.1.1.  This
+ address works for connections both to and from the loopback interface, but
+ does not show up as a configured address via netlink, which means booth
+ will fail to recognize it as a valid address.
+ .
+ This is only used in the tests, so just patch this out to use 127.0.0.1
+ explicitly instead of by resolving the hostname.
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+
+Index: booth-1.0/test/utils.py
+===================================================================
+--- booth-1.0.orig/test/utils.py
++++ booth-1.0/test/utils.py
+@@ -9,8 +9,6 @@
+     return (stdout, stderr, p.returncode)
+ 
+ def get_IP():
+-    (stdout, stderr, returncode) = run_cmd(['hostname', '-i'])
+-    if returncode != 0:
+-        return '127.0.0.1'
++    return '127.0.0.1'
+     # in case multiple IP addresses are returned, use only the first.
+     return re.sub(r'\s.*', '', stdout)


More information about the Debian-ha-maintainers mailing list