From: Rob Browning Date: Sun, 28 Mar 2021 18:14:26 +0000 (-0500) Subject: id-other-than: pass strings to getpwnam/getgrnam X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=commitdiff_plain;h=c7f0b53e35eb42b85a3a6b8f705f72738db126a5 id-other-than: pass strings to getpwnam/getgrnam Signed-off-by: Rob Browning --- diff --git a/dev/id-other-than b/dev/id-other-than index a6cab57..fa13d13 100755 --- a/dev/id-other-than +++ b/dev/id-other-than @@ -10,7 +10,7 @@ import grp import pwd import sys -from bup.compat import get_argvb +from bup.compat import get_argv, get_argvb def usage(): print('Usage: id-other-than <--user|--group> ID [ID ...]', @@ -30,7 +30,7 @@ def is_integer(x): return False excluded_ids = set(int(x) for x in argvb[2:] if is_integer(x)) -excluded_names = (x for x in argvb[2:] if not is_integer(x)) +excluded_names = (x for x in get_argv()[2:] if not is_integer(x)) if argvb[1] == b'--user': for x in excluded_names: diff --git a/test/ext/test-misc b/test/ext/test-misc index b69eaaa..6f3b2f3 100755 --- a/test/ext/test-misc +++ b/test/ext/test-misc @@ -129,4 +129,12 @@ expect_py_ver=$(LC_CTYPE=C "$top/dev/python" \ actual_py_ver=$(bup features | grep Python: | sed -Ee 's/ +Python: //') || exit $? WVPASSEQ "$expect_py_ver" "$actual_py_ver" + +WVSTART id-other-than +result=$("$top/dev/id-other-than" --user 0) || exit $? +WVPASS echo "$result" | WVPASS grep -qE '.*:[0-9]+$' +result=$("$top/dev/id-other-than" --group 0) || exit $? +WVPASS echo "$result" | WVPASS grep -qE '.*:[0-9]+$' + + WVPASS rm -rf "$tmpdir"