* [bug] handle .notmuch without xapian/ more gracefully @ 2021-12-14 12:47 David Bremner 2021-12-25 21:22 ` [PATCH 1/2] test/new: add known broken test for missing xapian directory David Bremner 0 siblings, 1 reply; 5+ messages in thread From: David Bremner @ 2021-12-14 12:47 UTC (permalink / raw) To: notmuch Several people have recently hit the problem where creating .notmuch directory (e.g. to add a hook) before running notmuch new causes notmuch new to fail. This is due to the way that notmuch currently detects a database directory. I'm not sure if this is easily fixable, but it would be nice to at least give better diagnostics. d ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] test/new: add known broken test for missing xapian directory. 2021-12-14 12:47 [bug] handle .notmuch without xapian/ more gracefully David Bremner @ 2021-12-25 21:22 ` David Bremner 2021-12-25 21:22 ` [PATCH 2/2] lib/open: do not consider .notmuch alone as an existing database David Bremner 0 siblings, 1 reply; 5+ messages in thread From: David Bremner @ 2021-12-25 21:22 UTC (permalink / raw) To: David Bremner, notmuch `notmuch new' should go ahead and create the xapian database if it is missing, even in the case where the parent .notmuch (or equivalent) directory exists. --- test/T055-path-config.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh index f0ce55da..374aea3b 100755 --- a/test/T055-path-config.sh +++ b/test/T055-path-config.sh @@ -318,7 +318,15 @@ to=m.header('To') print(to) EOF test_expect_equal_file EXPECTED OUTPUT - ;& # fall through + ;; + *) + backup_database + test_begin_subtest ".notmuch without xapian/ handled gracefully ($config)" + test_subtest_known_broken + rm -r $XAPIAN_PATH + test_expect_success "notmuch new" + restore_database + ;; esac case $config in -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] lib/open: do not consider .notmuch alone as an existing database. 2021-12-25 21:22 ` [PATCH 1/2] test/new: add known broken test for missing xapian directory David Bremner @ 2021-12-25 21:22 ` David Bremner 2021-12-29 17:48 ` Tomi Ollila 0 siblings, 1 reply; 5+ messages in thread From: David Bremner @ 2021-12-25 21:22 UTC (permalink / raw) To: David Bremner, notmuch It makes perfect sense for users to want to pre-create .notmuch, e.g. to install hooks, so we should handle the case of a .notmuch directory without an actual xapian database more gracefully. --- lib/open.cc | 8 ++------ test/T055-path-config.sh | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/open.cc b/lib/open.cc index a91d22ef..54510eac 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -661,16 +661,12 @@ notmuch_database_create_with_config (const char *database_path, err = mkdir (notmuch_path, 0755); if (err) { - if (errno == EEXIST) { - status = NOTMUCH_STATUS_DATABASE_EXISTS; - talloc_free (notmuch); - notmuch = NULL; - } else { + if (errno != EEXIST) { IGNORE_RESULT (asprintf (&message, "Error: Cannot create directory %s: %s.\n", notmuch_path, strerror (errno))); status = NOTMUCH_STATUS_FILE_ERROR; + goto DONE; } - goto DONE; } } diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh index 374aea3b..1df240dd 100755 --- a/test/T055-path-config.sh +++ b/test/T055-path-config.sh @@ -322,7 +322,6 @@ EOF *) backup_database test_begin_subtest ".notmuch without xapian/ handled gracefully ($config)" - test_subtest_known_broken rm -r $XAPIAN_PATH test_expect_success "notmuch new" restore_database -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] lib/open: do not consider .notmuch alone as an existing database. 2021-12-25 21:22 ` [PATCH 2/2] lib/open: do not consider .notmuch alone as an existing database David Bremner @ 2021-12-29 17:48 ` Tomi Ollila 2021-12-29 18:27 ` David Bremner 0 siblings, 1 reply; 5+ messages in thread From: Tomi Ollila @ 2021-12-29 17:48 UTC (permalink / raw) To: David Bremner, David Bremner, notmuch On Sat, Dec 25 2021, David Bremner wrote: > It makes perfect sense for users to want to pre-create .notmuch, > e.g. to install hooks, so we should handle the case of a .notmuch > directory without an actual xapian database more gracefully. Series LGTM. Tomi > --- > lib/open.cc | 8 ++------ > test/T055-path-config.sh | 1 - > 2 files changed, 2 insertions(+), 7 deletions(-) > > diff --git a/lib/open.cc b/lib/open.cc > index a91d22ef..54510eac 100644 > --- a/lib/open.cc > +++ b/lib/open.cc > @@ -661,16 +661,12 @@ notmuch_database_create_with_config (const char *database_path, > > err = mkdir (notmuch_path, 0755); > if (err) { > - if (errno == EEXIST) { > - status = NOTMUCH_STATUS_DATABASE_EXISTS; > - talloc_free (notmuch); > - notmuch = NULL; > - } else { > + if (errno != EEXIST) { > IGNORE_RESULT (asprintf (&message, "Error: Cannot create directory %s: %s.\n", > notmuch_path, strerror (errno))); > status = NOTMUCH_STATUS_FILE_ERROR; > + goto DONE; > } > - goto DONE; > } > } > > diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh > index 374aea3b..1df240dd 100755 > --- a/test/T055-path-config.sh > +++ b/test/T055-path-config.sh > @@ -322,7 +322,6 @@ EOF > *) > backup_database > test_begin_subtest ".notmuch without xapian/ handled gracefully ($config)" > - test_subtest_known_broken > rm -r $XAPIAN_PATH > test_expect_success "notmuch new" > restore_database > -- > 2.34.1 > > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] lib/open: do not consider .notmuch alone as an existing database. 2021-12-29 17:48 ` Tomi Ollila @ 2021-12-29 18:27 ` David Bremner 0 siblings, 0 replies; 5+ messages in thread From: David Bremner @ 2021-12-29 18:27 UTC (permalink / raw) To: Tomi Ollila, notmuch Tomi Ollila <tomi.ollila@iki.fi> writes: > On Sat, Dec 25 2021, David Bremner wrote: > >> It makes perfect sense for users to want to pre-create .notmuch, >> e.g. to install hooks, so we should handle the case of a .notmuch >> directory without an actual xapian database more gracefully. > > Series LGTM. Series applied to release and master d ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-29 18:27 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-12-14 12:47 [bug] handle .notmuch without xapian/ more gracefully David Bremner 2021-12-25 21:22 ` [PATCH 1/2] test/new: add known broken test for missing xapian directory David Bremner 2021-12-25 21:22 ` [PATCH 2/2] lib/open: do not consider .notmuch alone as an existing database David Bremner 2021-12-29 17:48 ` Tomi Ollila 2021-12-29 18:27 ` David Bremner
Code repositories for project(s) associated with this public inbox https://yhetil.org/notmuch.git/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).