]> arthur.barton.de Git - bup.git/commitdiff
id-other-than: pass strings to getpwnam/getgrnam
authorRob Browning <rlb@defaultvalue.org>
Sun, 28 Mar 2021 18:14:26 +0000 (13:14 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 28 Mar 2021 21:25:18 +0000 (16:25 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
dev/id-other-than
test/ext/test-misc

index a6cab57e5844be5989a3bfd5eebdc4738874d149..fa13d1390fc888d8b9033d3c9e5f5f80783c87bf 100755 (executable)
@@ -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:
index b69eaaa7b34179c57e72c13286ad41ed7fbf2f9a..6f3b2f377512ddd8708b0e0cac3b2d1c641f64ed 100755 (executable)
@@ -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"