]> arthur.barton.de Git - bup.git/blobdiff - t/test-meta.sh
test-meta.sh: use user's uid/gid, not 0
[bup.git] / 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##*:}"