From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2OL9FArVc2GYAQAAgWs5BA (envelope-from ) for ; Sat, 23 Oct 2021 11:25:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 8NGvEArVc2EqVwAAB5/wlQ (envelope-from ) for ; Sat, 23 Oct 2021 09:25:30 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (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 E464A15A4A for ; Sat, 23 Oct 2021 11:25:29 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 033FC2C1B0; Sat, 23 Oct 2021 05:25:09 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 80EF12906D for ; Sat, 23 Oct 2021 05:25:00 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 5F0CE5FC42; Sat, 23 Oct 2021 05:25:00 -0400 (EDT) Received: (nullmailer pid 1403461 invoked by uid 1000); Sat, 23 Oct 2021 09:24:54 -0000 From: David Bremner To: Austin Ray , notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 1/5] test: add two known broken tests for missing config files Date: Sat, 23 Oct 2021 06:24:47 -0300 Message-Id: <20211023092451.1403141-2-david@tethera.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211023092451.1403141-1-david@tethera.net> References: <20211023042225.xt36nzpsukqs6kid@athena> <20211023092451.1403141-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: BXEKCAWJIHF6D5MWDUNNAFD26PXAHHPG X-Message-ID-Hash: BXEKCAWJIHF6D5MWDUNNAFD26PXAHHPG 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634981130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc: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-unsubscribe:list-subscribe:list-post; bh=gBen/EPVmUlvPk/Wy2G4iG/MCRK6bSIwMXjGW5PydH4=; b=B4TLWPnc+3DgUI6t5ADjbR67uDHr7mLFEZx+c5fiZfCqE2FPq5yYyU7LJuZXCSicHKwoyj lS6Fd84o4pK+EuF9LM3pyqOR/N2ZD4FKbCsVpJ35FU7S0+4skQ1vd6xWBxaz2OTWbRTn+1 1776mhkBFygfV8OPg+D2FlpmFqIHP7plnY1aWREq0Eod3/25rjqwVigXiqv5tEe2UHgaU9 rLUN3b2pPnIklfn0OYoVfE+GsTGcdtbj4LVtI8J4co49/ddWvyalKRaC8rmedPl2VhW+/h /tVCYW+MauXRmU/0CjphxASpukYXqwhE/Nk4q6qcZTu1CArQBm4Qa3P/BDZ/vA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634981130; a=rsa-sha256; cv=none; b=VnQ71BRxkxM7/hrrbCHG8HbBuvxoFKqdbukWAfyGhy+JmYbRYoUfEgxhvS5/Heth3X6Zvo OiGmMv923cu0esmM1y9TVaCGtZN8ke7WQxBmxrC0lY4M0GOekc4p7LffHazocYZRC79QuU V1M5Jeuh1veh342klla4vVnNJemM2aBUzEj8yg4rWmd9q/S4K7y+UY8HqTe5/VMqlvkbWk 97qH8Dts1f16JaQGojD9PQVtPLTt3RDJU07ZjPGKUTYAvHFhDwbvtooGj0EVcbr8iS2y7O ERFj6hoo3uqWMFABmJKKRlQd1CLlbV4WStHKbDhqOE/dAYnjSYqMsw8Odl0fmQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.15 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: E464A15A4A X-Spam-Score: -1.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: ckvZby+MlXpJ The documentation claims that the database will be set to NULL in this case, but it is currently not happening. Based on a reproducer [1] from Austin Ray. [1]: id:20211021190401.imirxau2ewke6e2m@athena --- test/T590-libconfig.sh | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh index 59b82a6f..d2ea4a2b 100755 --- a/test/T590-libconfig.sh +++ b/test/T590-libconfig.sh @@ -849,4 +849,49 @@ zzzafter afterval EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "open: database set to null on missing config" +test_subtest_known_broken +test_C ${MAIL_DIR} "/nonexistent" < +int main (int argc, char **argv) { + notmuch_status_t stat; + notmuch_database_t *db = NULL; + + notmuch_status_t st = notmuch_database_open_with_config(argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + argv[2], NULL, &db, NULL); + printf("db == NULL: %d\n", db == NULL); +} +EOF +cat < EXPECTED +== stdout == +db == NULL: 1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "open: database set to null on missing config (env)" +test_subtest_known_broken +old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG} +NOTMUCH_CONFIG="/nonexistent" +test_C ${MAIL_DIR} < +int main (int argc, char **argv) { + notmuch_status_t stat; + notmuch_database_t *db = NULL; + + notmuch_status_t st = notmuch_database_open_with_config(argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + NULL, NULL, &db, NULL); + printf("db == NULL: %d\n", db == NULL); +} +EOF +NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG} +cat < EXPECTED +== stdout == +db == NULL: 1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + test_done -- 2.33.0