author | Maximiliano Curia
<maxy@gnuservers.com.ar> 2014-07-18 07:21:53 UTC |
committer | Maximiliano Curia
<maxy@gnuservers.com.ar> 2014-07-18 07:21:53 UTC |
parent | f84cd4c4d19503a81bdc9dc2a9dda71bd735470d |
debian/changelog | +2 | -0 |
debian/patches/series | +1 | -0 |
debian/patches/upstream_tests-Use-LOGNAME-instead-of-os.getlogin.patch | +56 | -0 |
diff --git a/debian/changelog b/debian/changelog index 5cc7f8d..3073a65 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,7 @@ kxd (0.12-2) UNRELEASED; urgency=medium + * New patch: upstream_tests-Use-LOGNAME-instead-of-os.getlogin.patch + (Closes: #755036) -- Maximiliano Curia <maxy@debian.org> Fri, 18 Jul 2014 09:19:06 +0200 diff --git a/debian/patches/series b/debian/patches/series index e84e98b..3eb0287 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ upstream_scripts-Fix-kxd-add-client-key-missing-fi-and-wrong-.patch +upstream_tests-Use-LOGNAME-instead-of-os.getlogin.patch diff --git a/debian/patches/upstream_tests-Use-LOGNAME-instead-of-os.getlogin.patch b/debian/patches/upstream_tests-Use-LOGNAME-instead-of-os.getlogin.patch new file mode 100644 index 0000000..f5e2689 --- /dev/null +++ b/debian/patches/upstream_tests-Use-LOGNAME-instead-of-os.getlogin.patch @@ -0,0 +1,56 @@ +From 2af6c0892cf34ca25e66cc7be328b75d6444970c Mon Sep 17 00:00:00 2001 +From: Alberto Bertogli <albertito@blitiri.com.ar> +Date: Thu, 17 Jul 2014 23:38:40 +0100 +Subject: [PATCH] tests: Use $LOGNAME instead of os.getlogin() + +The tests use os.getlogin() to get the user they're running under, which is +used just for informational names to make troubleshooting easier. + +However, that function fails when the controlling terminal isn't a tty; this +is triggered for example by the Debian automated build process, which is how +this bug was originally reported (http://bugs.debian.org/755036). + +To fix that, we can just try to get $LOGNAME from the environment, and fall +back to "unknown" if missing, which is harmless. + +Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar> +--- + tests/run_tests | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tests/run_tests b/tests/run_tests +index a967b3e..23bfadf 100755 +--- a/tests/run_tests ++++ b/tests/run_tests +@@ -48,6 +48,10 @@ DEVNULL = open("/dev/null", "w") + + TEMPDIR = "/does/not/exist" + ++# User the script is running as. Just informational, for troubleshooting ++# purposes, so we don't care if it's missing. ++LOGNAME = os.environ.get('LOGNAME', 'unknown') ++ + + def setUpModule(): # pylint: disable=invalid-name + if not os.path.isfile(BINS + "/kxd"): +@@ -90,7 +94,7 @@ class Config(object): + req_args = ["openssl", "req", "-new", "-batch", + "-subj", ("/commonName=*" + + "/organizationalUnitName=kxd-tests-%s:%s@%s" % ( +- self.name, os.getlogin(), platform.node())), ++ self.name, LOGNAME, platform.node())), + "-key", "%s/key.pem" % self.path] + if self_sign: + req_args.extend(["-x509", "-out", "%s/cert.pem" % self.path]) +@@ -127,7 +131,7 @@ class CA(object): + "-config", OPENSSL_CONF, + "-subj", ("/commonName=*" + + "/organizationalUnitName=kxd-tests-ca:%s@%s" % ( +- os.getlogin(), platform.node())), ++ LOGNAME, platform.node())), + "-extensions", "v3_ca", "-nodes", + "-keyout", "cakey.pem", + "-out", "cacert.pem"], +-- +2.0.1 +