Add a file for scandir to find, but use gdb to remove it before it
gets indexed.


The ugly part is that this should require gdb as external dep... but
we shouldn't skip all of if gdb isn't there. I'm in a
hurry, any good ideas?
 test/ | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/test/ b/test/
index beeb574a3b30..072b63a148cc 100755
--- a/test/
+++ b/test/
@@ -298,4 +298,34 @@ output=$(NOTMUCH_NEW --debug 2>&1 | sed 's/: .*$//' )
 chmod u+w  ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
 test_expect_equal "$output" "A Xapian exception occurred opening database"
+test_begin_subtest "Handle files vanishing between scandir and add_file"
+# A file for scandir to find. It won't get indexed, so can be empty.
+touch ${MAIL_DIR}/vanish
+# Breakpoint to remove the file before indexing
+cat <<EOF > notmuch-new-vanish.gdb
+set breakpoint pending on
+set logging file notmuch-new-vanish-gdb.log
+set logging on
+break add_file
+shell rm -f ${MAIL_DIR}/vanish
+gdb --batch-silent --return-child-result -x notmuch-new-vanish.gdb \
+    --args notmuch new 2>OUTPUT 1>/dev/null
+echo "exit status: $?" >> OUTPUT
+Unexpected error with file ${MAIL_DIR}/vanish
+add_file: Something went wrong trying to read or write a file
+Error opening ${MAIL_DIR}/vanish: No such file or directory
+exit status: 75
+test_expect_equal_file EXPECTED OUTPUT

notmuch mailing list

Reply via email to