]> arthur.barton.de Git - bup.git/commitdiff
test-ls.sh: get the group and gid from the filesystem.
authorRob Browning <rlb@defaultvalue.org>
Sat, 22 Mar 2014 15:25:32 +0000 (10:25 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 22 Mar 2014 15:25:32 +0000 (10:25 -0500)
Get the expected gid from the filesystem, not "id", because on some
platforms (BSDs, etc.) a new path's gid is taken from the parent
directory, not the effective gid.

Thanks to Thomas Klausner <tk@giga.or.at> for reporting the problem
and to him and Greg Troxel <gdt@ir.bbn.com> for helping craft the
solution.

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

index 4a9e5b1a474642fe42dfef16cfcc222b68b13f96..c4f4a1a624d482e20d55208b0433d351fe4eac5f 100755 (executable)
@@ -132,9 +132,10 @@ symlink_date="$(WVPASS echo "$symlink_date" \
     || exit $?
 
 uid="$(id -u)" || exit $?
-gid="$(id -g)" || exit $?
+gid="$(python -c 'import os; print os.stat("src").st_gid')" || exit $?
 user="$(id -un)" || exit $?
-group="$(id -gn)" || exit $?
+group="$(python -c 'import grp, os;
+print grp.getgrgid(os.stat("src").st_gid)[0]')" || exit $?
 
 WVPASSEQ "$(bup ls -l src/latest"$tmpdir"/src | tr -s ' ' ' ')" \
 "-rwx------ $user/$group 0 1969-07-20 20:18 executable