summaryrefslogtreecommitdiff
path: root/tests/basic-test.sh
diff options
context:
space:
mode:
authorJonathan Lebon <jlebon@redhat.com>2017-09-28 19:08:06 +0000
committerAtomic Bot <atomic-devel@projectatomic.io>2017-09-30 00:05:07 +0000
commit8fe45362578a43260876134d6547ebd0bb2485c3 (patch)
treee91911b8e084a18a43b55d5420dcae20d6fba955 /tests/basic-test.sh
parente4a90caeb9d210344e537e2a9b8016dc0e01e15a (diff)
downloadostree-8fe45362578a43260876134d6547ebd0bb2485c3.tar.gz
lib/commit: don't query devino cache for modified files
We can't use the cache if the file we want to commit has been modified by the client through the file info or xattr modifiers. We would prematurely look into the cache in `write_dfd_iter_to_mtree_internal`, regardless of whether any filtering applied. We remove that path there, and make sure that we only use the cache if there were no modifications. We rename the `get_modified_xattrs` to `get_final_xattrs` to reflect the fact that the xattrs may not be modified. One tricky bit that took me some time was that we now need to store the st_dev & st_ino values in the GFileInfo because the cache lookup relies on it. I'm guessing we regressed on this at some point. This patch does slightly change the semantics of the xattr callback. Previously, returning NULL from the cb meant no xattrs at all. Now, it means to default to the on-disk state. We might want to consider putting that behind a flag instead. Though it seems like a more useful behaviour so that callers can only override the files they want to without losing original on-disk state (and if they don't want that, just return an empty GVariant). Closes: #1165 Closes: #1170 Approved by: cgwalters
Diffstat (limited to 'tests/basic-test.sh')
-rw-r--r--tests/basic-test.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/basic-test.sh b/tests/basic-test.sh
index 4df6a079..a01f437a 100644
--- a/tests/basic-test.sh
+++ b/tests/basic-test.sh
@@ -19,7 +19,7 @@
set -euo pipefail
-echo "1..$((72 + ${extra_basic_tests:-0}))"
+echo "1..$((73 + ${extra_basic_tests:-0}))"
CHECKOUT_U_ARG=""
CHECKOUT_H_ARGS="-H"
@@ -603,6 +603,24 @@ $OSTREE checkout test2 test2-checkout
echo "ok commit with link speedup"
cd ${test_tmpdir}
+rm -rf test2-checkout
+$OSTREE checkout test2 test2-checkout
+# set cow to different perms, but re-set cowro to the same perms
+cat > statoverride.txt <<EOF
+=$((0600)) /baz/cow
+=$((0600)) /baz/cowro
+EOF
+$OSTREE commit ${COMMIT_ARGS} --statoverride=statoverride.txt \
+ --table-output --link-checkout-speedup -b test2-tmp test2-checkout > stats.txt
+$OSTREE diff test2 test2-tmp > diff-test2
+assert_file_has_content diff-test2 'M */baz/cow$'
+assert_not_file_has_content diff-test2 'M */baz/cowro$'
+assert_not_file_has_content diff-test2 'baz/saucer'
+# only /baz/cow is a cache miss
+assert_file_has_content stats.txt '^Content Written: 1$'
+echo "ok commit with link speedup and modifier"
+
+cd ${test_tmpdir}
$OSTREE ls test2
echo "ok ls with no argument"