From: Rob Browning Date: Fri, 6 Dec 2013 16:18:37 +0000 (-0600) Subject: t/test-meta.sh: handle systems that have sgid directories. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f2f71c81b0c379533c365b89ed4c24f6e127ac32;p=packages%2Fb%2Fbup.git t/test-meta.sh: handle systems that have sgid directories. 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 for reporting the problem and helping track down the solution. Signed-off-by: Rob Browning --- diff --git a/t/test-meta.sh b/t/test-meta.sh index 91004c0..b247e7a 100755 --- a/t/test-meta.sh +++ b/t/test-meta.sh @@ -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