From 290768c34bc51dac23b13c83eb61d83a4be61767 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Sun, 1 Jan 2023 16:27:52 +0400 Subject: [PATCH] Add new --ignore-permission-errors test ``` $ bats --filter '^ignore perm' ./cli-tests/ 1..1 not ok 1 ignore permission errors on parent path elements ``` ``` $ export PATH=$PWD/target/release:$PATH $ bats --filter '^ignore perm' ./cli-tests/ 1..1 ok 1 ignore permission errors on parent path elements ``` --- cli-tests/cli-tests.bats | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cli-tests/cli-tests.bats b/cli-tests/cli-tests.bats index 43e5390..f2c7c76 100644 --- a/cli-tests/cli-tests.bats +++ b/cli-tests/cli-tests.bats @@ -1183,3 +1183,17 @@ _concurrent_modify_worker () { --dev-bind / / \ -- $(which bash) "$BATS_TEST_DIRNAME"/s3-parallel-thrash.sh } + +@test "ignore permission errors on parent path elements" { + # Create something readable that is always backed up such that the operation + # is still considered succesful while other paths could not be backed up. + mkdir "$SCRATCH/userdir" + # Lacking test code to create files owned by another user, + # assume /root/ is not readable. + + # The indexer must handle EACCES in any path element, i.e. gracefully stop at + # the first inaccessible parent directory. + id=$(bupstash put --ignore-permission-errors :: "$SCRATCH/userdir" /root/rootfile) + rootuid=$(bupstash list-contents --format=jsonl1 --pick root/ id=$id | jq .uid) + test 0 = $rootuid +}