]> arthur.barton.de Git - bup.git/commitdiff
t/test-meta.sh: handle systems that have sgid directories.
authorRob Browning <rlb@defaultvalue.org>
Fri, 6 Dec 2013 16:18:37 +0000 (10:18 -0600)
committerRob Browning <rlb@defaultvalue.org>
Tue, 10 Dec 2013 01:04:10 +0000 (19:04 -0600)
Explicitly chown the test directory to a group we're in so that the
tests will work on systems that have sgid directories by default
(i.e. NetBSD, etc.).

Thanks to Thomas Klausner <tk@giga.or.at> for reporting the problem
and helping track down the solution.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
t/test-meta.sh

index 91004c0a4796897c2a1f06fa027b27b8621c7482..b247e7ad7be2c3d3d26074a82dc996cbb0289e3e 100755 (executable)
@@ -418,11 +418,20 @@ src/foo/3"
         exit 0
     fi
 
+    first_group="$(WVPASS python -c 'import os,grp; \
+      print grp.getgrgid(os.getgroups()[0])[0]')" || exit $?
+    last_group="$(python -c 'import os,grp; \
+      print grp.getgrgid(os.getgroups()[-1])[0]')" || exit $?
+
     WVSTART 'metadata (restoration of ownership)'
     WVPASS force-delete "$TOP/bupmeta.tmp"
     WVPASS mkdir "$TOP/bupmeta.tmp"
     WVPASS cd "$TOP/bupmeta.tmp"
     WVPASS touch src
+    # Some systems always assign the parent dir group to new paths
+    # (sgid).  Make sure the group is one we're in.
+    WVPASS chgrp -R "$first_group" src
+
     WVPASS bup meta -cf src.meta src
 
     WVPASS mkdir dest
@@ -436,8 +445,6 @@ src/foo/3"
     WVPASS bup xstat src | WVPASS grep -qvE '^user: root'
 
     # Make sure we can restore one of the user's groups.
-    last_group="$(python -c 'import os,grp; \
-      print grp.getgrgid(os.getgroups()[0])[0]')"
     WVPASS rm -rf src
     WVPASS bup meta --edit --set-group "$last_group" ../src.meta \
         | WVPASS bup meta -x