summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2017-12-10 19:39:38 +0000
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-02 14:31:36 +0000
commitf63e62fbd272edbdd9695a10d841fc6b5eb69df8 (patch)
tree548840786a731af6a1427f62ebc422cb5e25b988
parent8d3d14503b3105f93db635022e881e02688f2db4 (diff)
downloadostree-f63e62fbd272edbdd9695a10d841fc6b5eb69df8.tar.gz
tests: Don't assume uid == primary gid
Nothing guarantees that each user has a group containing only themselves. Even if they do, nothing guarantees that its group ID equals the user ID, particularly if another user earlier in the same range was created without a corresponding group or vice versa. Signed-off-by: Simon McVittie <smcv@collabora.com> Closes: #1390 Approved by: cgwalters
-rwxr-xr-xtests/test-basic-user.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/test-basic-user.sh b/tests/test-basic-user.sh
index 7f970b5c..6987e4ad 100755
--- a/tests/test-basic-user.sh
+++ b/tests/test-basic-user.sh
@@ -104,18 +104,20 @@ cd ${test_tmpdir}
rm -rf test2-checkout
$OSTREE checkout -H -U test2 test2-checkout
# With --link-checkout-speedup, specifying --owner-uid should "win" by default.
-myid=$(id -u)
-newid=$((${myid} + 1))
-$OSTREE commit ${COMMIT_ARGS} --owner-uid ${newid} --owner-gid ${newid} \
+myuid=$(id -u)
+mygid=$(id -g)
+newuid=$((${myuid} + 1))
+newgid=$((${mygid} + 1))
+$OSTREE commit ${COMMIT_ARGS} --owner-uid ${newuid} --owner-gid ${newgid} \
--link-checkout-speedup -b test2-linkcheckout-test --tree=dir=test2-checkout
$OSTREE ls test2-linkcheckout-test /baz/cow > ls.txt
-assert_file_has_content ls.txt "^-006.. ${newid} ${newid} .*/baz/cow"
+assert_file_has_content ls.txt "^-006.. ${newuid} ${newgid} .*/baz/cow"
# But --devino-canonical should override that
-$OSTREE commit ${COMMIT_ARGS} --owner-uid ${newid} --owner-gid ${newid} \
+$OSTREE commit ${COMMIT_ARGS} --owner-uid ${newuid} --owner-gid ${newgid} \
-I -b test2-devino-test --tree=dir=test2-checkout
$OSTREE ls test2-devino-test /baz/cow > ls.txt
-assert_file_has_content ls.txt "^-006.. ${myid} ${myid} .*/baz/cow"
+assert_file_has_content ls.txt "^-006.. ${myuid} ${mygid} .*/baz/cow"
$OSTREE refs --delete test2-{linkcheckout,devino}-test
echo "ok commit with -I"