[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 61f83856fb1365e8c9df525dbcc5b74708ddbfe4

Ville Skyttä ville.skytta at iki.fi
Mon Feb 1 19:39:31 UTC 2010


The following commit has been merged in the master branch:
commit 61f83856fb1365e8c9df525dbcc5b74708ddbfe4
Author: Leonard Crestez <cdleonard at gmail.com>
Date:   Mon Feb 1 21:28:17 2010 +0200

    (testsuite) Fix chown test "crash" if root user/group is N/A (Alioth: 312306).

diff --git a/test/lib/completions/chown.exp b/test/lib/completions/chown.exp
index cc56149..480f674 100644
--- a/test/lib/completions/chown.exp
+++ b/test/lib/completions/chown.exp
@@ -24,10 +24,14 @@ set partgroup "roo"
 
 # Skip tests if root:root not available or if roo:roo matches multiple
 # users/groups
-if {[exec bash -c "compgen -A user $partuser" | wc -l] > 1 ||
-    [exec bash -c "compgen -A user $fulluser" | wc -l] != 1 ||
-    [exec bash -c "compgen -A group $partgroup" | wc -l] > 1 ||
-    [exec bash -c "compgen -A group $fullgroup" | wc -l] != 1} {
+#
+# compgen -A is used because it's a bash builtin and available everywhere.
+# The || true part prevents exec from throwing an exception if nothing is
+# found.
+if {[exec bash -c "compgen -A user $partuser || true" | wc -l] > 1 ||
+    [exec bash -c "compgen -A user $fulluser || true" | wc -l] != 1 ||
+    [exec bash -c "compgen -A group $partgroup || true" | wc -l] > 1 ||
+    [exec bash -c "compgen -A group $fullgroup || true" | wc -l] != 1} {
     untested "Not running complex chown tests."
 } else {
     assert_complete $fulluser "chown $partuser"

-- 
bash-completion



More information about the Bash-completion-commits mailing list