From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:f42::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AB2SFMSLx2GZTQAAgWs5BA (envelope-from ) for ; Sat, 25 Dec 2021 22:23:16 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id SItmEcSLx2FErwAAauVa8A (envelope-from ) for ; Sat, 25 Dec 2021 22:23:16 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EDB92E1AF for ; Sat, 25 Dec 2021 22:23:15 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id EBD625F723; Sat, 25 Dec 2021 21:23:07 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 8626A5F71B for ; Sat, 25 Dec 2021 21:23:04 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id E13285FC48; Sat, 25 Dec 2021 16:23:03 -0500 (EST) Received: (nullmailer pid 3302562 invoked by uid 1000); Sat, 25 Dec 2021 21:23:01 -0000 From: David Bremner To: David Bremner , notmuch@notmuchmail.org Subject: [PATCH 2/2] lib/open: do not consider .notmuch alone as an existing database. Date: Sat, 25 Dec 2021 17:22:56 -0400 Message-Id: <20211225212256.3302545-2-david@tethera.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211225212256.3302545-1-david@tethera.net> References: <87a6h3xsir.fsf@tethera.net> <20211225212256.3302545-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: QGE4Z4EJPHZK464OC574JLGZXTA6PZ4F X-Message-ID-Hash: QGE4Z4EJPHZK464OC574JLGZXTA6PZ4F X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640467396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=iXL6lj6aA+LdS3ooa70F5BNu8fPvt0+re/PgzDOW6S8=; b=Qt1O7WHSXmx1IRhYDRzf+zvKyHJjViKP+fdrm5AFJrVUZonS+sHesrr5tKNwePopF8ks4r qseLuqvwa6MWOL8tGRpOoBuTOn7qIrOK5ZuV871dYXvojG/xKuZVUaCOiVeilwtyrFDTnH UotMaHlDo1Gr2TLz2I2dwTU+zFCGJIShU/MsVvyJ9MLYMeBnFrSpLF08vQKCSgHOkwLHY+ aIjqyvDxR1ws/dFXms4OR9i8V6VnFNwibwZAyE2P1NIaSxrFVeMw35cgFVgivXB3GdQNyb ClNtufEwZHG2AeBatvT7mP93xu5Z9DQ6+AcKp3eriSRwcByqFLXY2P+aXbnMfg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640467396; a=rsa-sha256; cv=none; b=Z20bnCL6PWEEknk2t8MmyMOcEoIV5x+AW4WPvU+aCtg/pSTDmsBy1EM6DcQmtkDE2uIg0H wqyM3JQY078LUgzDO1Ut/3Rnn4J5jMKa4yGo1Sf/6NkbpkTP4MZEJ7lWrKlokqJDIiKPg7 9u5LU9Y/8K4ZXGeMu7vFG6cHHg+UtNyp3yi95uKQVBg+RmTgzi99Lbx3UOLe6pbsQ/fPaS ooi0Zi6LApFnN2NdyCcukCrvmA5/3dVlho+IVfUI2vSYgGafxwTZUhMSgRxSD6YTmFHDAa BiZE484AYtJy+PJdudDTHWAiTB1wu2Y8IeBmJRRkslGnACxCUxet1nmRXv5+HQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.17 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: EDB92E1AF X-Spam-Score: -1.17 X-Migadu-Scanner: scn1.migadu.com X-TUID: d+kSxlDh9Hc8 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