repo: Add checksum to error message opening unreadable object

This would have debugged trying to do a pull as non-root from
a sysroot repository.  See for example:
https://github.com/ostreedev/ostree/issues/1562

Closes: #1564
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2018-05-01 19:22:10 +00:00
1 parent 11c12cc19a
commit 36ac768fb7
2 files changed
+22 -1

No files matched your search

@@ -21,3 +21,21 @@ trap _tmpdir_cleanup EXIT
/usr/libexec/installed-tests/libostree/test-basic.sh
/usr/libexec/installed-tests/libostree/test-basic-c
date
# Test error message when opening a non-world-readable object
# https://github.com/ostreedev/ostree/issues/1562
rm repo files -rf
chmod a+rx .
ostree --repo=repo init --mode=bare
mkdir files
touch files/unreadable
chmod 0 files/unreadable
ostree --repo=repo commit -b testbranch --tree=dir=files
# We should be able to read as root due to CAP_DAC_OVERRIDE
ostree --repo=repo cat testbranch /unreadable >/dev/null
if setpriv --reuid bin --regid bin --clear-groups ostree --repo=repo cat testbranch /unreadable 2>err.txt; then
fatal "Listed unreadable object as non-root"
fi
assert_file_has_content err.txt "Opening content object.*openat: Permission denied"
date