lib/repo: Immediately error creating bare-user repo on tmpfs

And in general, if for some reason we can't write `user.` xattrs, provide an
error immediately rather than doing it during a later pull. This way the failure
cause is a lot more obvious.

Related: https://github.com/ostreedev/ostree/issues/991

Closes: #993
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-07-06 14:31:37 +00:00
1 parent 3234295324
commit 23b93a3eb6
4 files changed
+61 -24

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
# Test that initializing a bare-user repo on tmpfs fails
# Maybe at some point this will be fixed in the kernel
# but I doubt it'll be soon
# https://www.spinics.net/lists/linux-mm/msg109775.html
set -xeuo pipefail
dn=$(dirname $0)
. ${dn}/libinsttest.sh
test_tmpdir=$(prepare_tmpdir)
trap _tmpdir_cleanup EXIT
cd ${test_tmpdir}
mkdir mnt
mount -t tmpfs tmpfs mnt
if ostree --repo=mnt/repo init --mode=bare-user 2>err.txt; then
umount mnt
assert_not_reached "bare-user on tmpfs worked?"
fi
umount mnt
assert_file_has_content err.txt "Operation not supported"