From 5a582e8ed9b9bfd88e63149fb671510bc2b2e9f8 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 3 Dec 2023 11:41:11 -0400 Subject: [PATCH 1/2] test: add known broken test for incorrect error message Duplicate bug reported in id:87wmtvcor5.fsf@alyssa.is The error message is nonsense, because notmuch config list actually includes the database in those two cases. --- test/T055-path-config.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh index efc79e8b..fcaf09d3 100755 --- a/test/T055-path-config.sh +++ b/test/T055-path-config.sh @@ -374,6 +374,12 @@ EOF notmuch new test_expect_equal "$(xapian-metadata get ${XAPIAN_PATH} version)" 3 ;; + home_mail|maildir_env) + test_begin_subtest "No errors from config list ($config)" + test_subtest_known_broken + notmuch config list 2>OUTPUT 1>/dev/null + test_expect_equal_file /dev/null OUTPUT + ;; *) backup_database test_begin_subtest ".notmuch without xapian/ handled gracefully ($config)" From b97cd90040a8353e6f94c317af2020f3d6e67a2e Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 3 Dec 2023 14:56:44 -0400 Subject: [PATCH 2/2] lib: clear error message on success in _choose_database_path Previously we both found a database and returned a message saying that the database could not be found (along with a success code). This change should prevent spurious error output. --- lib/open.cc | 5 +++++ test/T055-path-config.sh | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/open.cc b/lib/open.cc index 005872dc..463e38bf 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -249,6 +249,11 @@ _choose_database_path (notmuch_database_t *notmuch, return NOTMUCH_STATUS_NO_DATABASE; } + if (*message) { + free (*message); + *message = NULL; + } + return NOTMUCH_STATUS_SUCCESS; } diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh index fcaf09d3..1feb5624 100755 --- a/test/T055-path-config.sh +++ b/test/T055-path-config.sh @@ -376,7 +376,6 @@ EOF ;; home_mail|maildir_env) test_begin_subtest "No errors from config list ($config)" - test_subtest_known_broken notmuch config list 2>OUTPUT 1>/dev/null test_expect_equal_file /dev/null OUTPUT ;;