[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1070012: keyutils: testsuite wrongly assumes that user 0 always exists



Source: keyutils
Version: 1.6.3-3
Severity: important
Tags: patch upstream ftbfs
X-Debbugs-Cc: debian-wb-team@lists.debian.org
Usertags: unshare

Dear maintainer,

keyutils fails to build from source when built inside a container:

| === /<<PKGBUILDDIR>>/tests/keyctl/newring/bad-args/test.out ===
| ./runtest.sh: line 13: [: 4096: unary operator expected
| +++ CHECK MAXLEN DESC FAILS WITH EDQUOT
| FAILED
| FAILED
| +++ CHECK OVERLONG DESC
| +++ CHECK EMPTY KEYRING NAME
| +++ CHECK BAD KEY ID
| make[3]: *** [Makefile:41: run] Error 1
| make[3]: Leaving directory '/<<PKGBUILDDIR>>/tests'
| make[2]: *** [Makefile:253: test] Error 2
| make[2]: Leaving directory '/<<PKGBUILDDIR>>'
| dh_auto_test: error: make -j4 test PATH=/<<PKGBUILDDIR>>:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games LD_LIBRARY_PATH=/<<PKGBUILDDIR>> SKIPROOTREQ=yes SKIPINSTALLREQ=yes returned exit code 2
| make[1]: *** [debian/rules:25: override_dh_auto_test] Error 25
| make[1]: Leaving directory '/<<PKGBUILDDIR>>'
| make: *** [debian/rules:10: binary] Error 2
| dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

The "unary operator expected" issue is because maxsquota is undefined.
Indeed it is defined by looking at /proc/key-users for user 0 (root),
however this user does necessary not exists in a container. In addition
as the testsuite is run as non-root (contrary to what upstream
recommends), I believe the returned values are incorrect. At least on my
system they are quite different between root and normal users.

This simple one-liner fixes the issue, and should still work fine with
the testsuite run as root:

--- keyutils-1.6.3.orig/tests/toolbox.inc.sh
+++ keyutils-1.6.3/tests/toolbox.inc.sh
@@ -45,7 +45,7 @@ fi
 
 maxcall=$fullpage
 
-maxsquota=`grep '^ *0': /proc/key-users | sed s@.*/@@`
+maxsquota=`grep "^ *$UID": /proc/key-users | sed s@.*/@@`
 
 key_gc_delay_file="/proc/sys/kernel/keys/gc_delay"
 if [ -f $key_gc_delay_file ]; then

Regards
Aurelien


Reply to: