aboutsummaryrefslogtreecommitdiff
path: root/test/T562-lib-database.sh
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2020-07-18 21:11:28 -0300
committerDavid Bremner <david@tethera.net>2020-07-22 19:52:55 -0300
commitc477d7ce311335fda16a15e624ca3931d79144cf (patch)
treec78db52fb1be1b43442797abe9d95aa9792a21ea /test/T562-lib-database.sh
parentbe3f4aec3f9006d066fe092e7fe0810c5a0f86e0 (diff)
lib: convert relative filenames to absolute in n_d_index_file
The API docs promise to handle relative filenames, but the code did not do it. Also check for files outside the mail root, as implied by the API description. This fixes the bug reported at id:87sgdqo0rz.fsf@tethera.net
Diffstat (limited to 'test/T562-lib-database.sh')
-rwxr-xr-xtest/T562-lib-database.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/T562-lib-database.sh b/test/T562-lib-database.sh
index e8263a14..e64f0f12 100755
--- a/test/T562-lib-database.sh
+++ b/test/T562-lib-database.sh
@@ -258,7 +258,6 @@ test_expect_equal_file EXPECTED OUTPUT
generate_message '[filename]=relative_path'
test_begin_subtest "index file (relative path)"
-test_subtest_known_broken
cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
{
notmuch_message_t *msg;
@@ -273,4 +272,21 @@ cat <<EOF > EXPECTED
EOF
test_expect_equal_file EXPECTED OUTPUT
+test_begin_subtest "index file (absolute path outside mail root)"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+ {
+ notmuch_message_t *msg;
+ stat = notmuch_database_index_file (db, "/dev/zero", NULL, &msg);
+ printf ("%d\n", stat == NOTMUCH_STATUS_FILE_ERROR);
+ }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+== stderr ==
+Error opening /dev/zero: path outside mail root
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+
test_done