]> arthur.barton.de Git - bup.git/commitdiff
Use python, not groups to grab a user group in t/test-meta.sh.
authorRob Browning <rlb@defaultvalue.org>
Tue, 11 Sep 2012 01:53:45 +0000 (20:53 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 22 Dec 2012 19:31:54 +0000 (13:31 -0600)
Group names may actually contain spaces, and since the groups commmand
only reports a space-delimited list of groups on stdout, we had
a problem.

Thanks to "Oei, Yung-Chin" <yungchin@yungchin.nl> and Gabriel Filion
<lelutin@gmail.com> for tracking this down.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
t/test-meta.sh

index 3ce1d553113a3e7d66f656bd075d585584ac1896..ba7e218c959e3ebdb3f84aad448e587a7145d9c6 100755 (executable)
@@ -220,8 +220,8 @@ WVSTART 'meta --edit'
     WVPASS bup xstat src | grep -qvE '^user: root'
 
     # Make sure we can restore one of the user's groups.
-    user_groups="$(groups)"
-    last_group="$(echo ${user_groups/* /})"
+    last_group="$(python -c 'import os,grp; \
+      print grp.getgrgid(os.getgroups()[0])[0]')"
     rm -rf src
     WVPASS bup meta --edit --set-group "$last_group" ../src.meta \
         | WVPASS bup meta -x