Re: [PATCH 2/2] lib/open: do not consider .notmuch alone as an existing database.

Subject: Re: [PATCH 2/2] lib/open: do not consider .notmuch alone as an existing database.

Date: Wed, 29 Dec 2021 19:48:37 +0200

To: David Bremner, David Bremner, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


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
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: