]> arthur.barton.de Git - bup.git/commitdiff
test-meta.sh: use user's uid/gid, not 0
authorPatrick Rouleau <prouleau72@gmail.com>
Thu, 3 Jul 2014 00:58:38 +0000 (20:58 -0400)
committerRob Browning <rlb@defaultvalue.org>
Thu, 3 Jul 2014 18:07:42 +0000 (13:07 -0500)
Cygwin does not fully support uid and gid of 0. Instead, use the
current user's ids to avoid portability problems. Since this test is
not run for ordinary users, the result is the same.

Signed-off-by: Patrick Rouleau <prouleau72@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
t/test-meta.sh

index 31cd772a569257093144bcd8a4a4dbd43e080def..ab6e5a4c906d9f8fde61a57bc97713c0889f8efc 100755 (executable)
@@ -502,23 +502,26 @@ src/foo/3"
         exit 0
     fi
 
+    uid=$(WVPASS id -un) || exit $?
+    gid=$(WVPASS id -gn) || exit $?
+
     WVSTART 'metadata (restoration of ownership as root)'
     WVPASS force-delete "$TOP/bupmeta.tmp"
     WVPASS mkdir "$TOP/bupmeta.tmp"
     WVPASS cd "$TOP/bupmeta.tmp"
     WVPASS touch src
-    WVPASS chown 0:0 src # In case the parent dir is sgid, etc.
+    WVPASS chown "$uid:$gid" src # In case the parent dir is sgid, etc.
     WVPASS bup meta -cf src.meta src
 
     WVPASS mkdir dest
     WVPASS chmod 700 dest # so we can't accidentally do something insecure
     WVPASS cd dest
 
-    other_uinfo="$(id-other-than --user "$(id -un)")"
+    other_uinfo="$(id-other-than --user "$uid")"
     other_user="${other_uinfo%%:*}"
     other_uid="${other_uinfo##*:}"
 
-    other_ginfo="$(id-other-than --group "$(id -gn)")"
+    other_ginfo="$(id-other-than --group "$gid")"
     other_group="${other_ginfo%%:*}"
     other_gid="${other_ginfo##*:}"