From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id pR3/Lzr+eWFxBQAAgWs5BA (envelope-from ) for ; Thu, 28 Oct 2021 03:34:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id IDolKzr+eWGDJwAA1q6Kng (envelope-from ) for ; Thu, 28 Oct 2021 01:34:50 +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) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3DE2322C61 for ; Thu, 28 Oct 2021 03:34:50 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id DFA551F975; Wed, 27 Oct 2021 21:34:36 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 090FA1F73C for ; Wed, 27 Oct 2021 21:34:30 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id CC3115FC42; Wed, 27 Oct 2021 21:34:29 -0400 (EDT) Received: (nullmailer pid 3999832 invoked by uid 1000); Thu, 28 Oct 2021 01:34:25 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 1/3] test: add known broken test for conflict with database parameter Date: Wed, 27 Oct 2021 22:34:17 -0300 Message-Id: <20211028013419.3996019-2-david@tethera.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211028013419.3996019-1-david@tethera.net> References: <20211028013419.3996019-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: MZNJND6KPAV7JRD2B5TEOCN3YTXU6ZUL X-Message-ID-Hash: MZNJND6KPAV7JRD2B5TEOCN3YTXU6ZUL 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635384890; 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=cN23BaC096Abe7NQa5N9itGS0ONkCZLxNip9DOL9elY=; b=saoTz893juc2u8BDT52Ua7Ol1mhiclACRZhypTd78wmniyoZv9dpG43MBakp/c03OmQtuE fXHq1Dd2h6aQpCUBAXGhFrRFKpKYw3SvkLjEL1SFmaWs6fznNKgSJwEMtOMYojLiGGwJoa nxgPkaDsi1Ohl99ZOk0b92hNq9zIPt8KupHjIjfSsgjOOYHeqMxU3q6UbfT3OHFPtIn2Oy RdABQ7TdnydzCiqxQIHRXpMQOTFvgbqe5ZSDADgV8upF7IARTE4ff5pAzuhCdV5aqIdAgZ lZTzZpiRn8Ejy8pcEz/LfEAjvIMVKE+m4R1u/za7RxP8/OU87O8JG/TNlmnXqg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635384890; a=rsa-sha256; cv=none; b=Dfnr79kjm338dHRBCM7TZv3xQeJirWNDOQfdJ2gijE72jWxu8aPNgKK8BvzJoevep81stw AcHrAeBZ8S/2EK+pl8gO8KT1PDiY++EJhrAeiaMw4+axduyNasVnXFystOPIAL7Ntzm8i+ 0Bfl9vY+K7EatN5oO1qjRY4LQB6utgVnBdU2uTPaOPFhDYkWGUbo3Fv7/nRbjKhTAWXhiz dY4+VOqb0o8Y6kfVfXPKh5lIZGXE9BzZ3Mz9QRoy55wQq057lJ//f5Gp9EbAOK41mjo+Ir 8sacoKWG/jceAyI0pl5i7c9iheHLJsbWcM7U3vEv/R/PSo0sMK43uJ5tISk0/w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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: 3DE2322C61 X-Spam-Score: -1.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: YzRxpjk7SA7S This is arguably user error: having configuration file with bad settings in it (and/or having a bad NOTMUCH_CONFIG environment variable). On the other hand returning a different path than was actually opened is definitely a bug. --- test/T590-libconfig.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh index c9471dc4..eab70ae9 100755 --- a/test/T590-libconfig.sh +++ b/test/T590-libconfig.sh @@ -933,7 +933,7 @@ NOTMUCH_CONFIG="/nonexistent" cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} notmuch_status_t st = notmuch_database_load_config(argv[1], NULL, NULL, &db, NULL); EOF -NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG} +export NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG} cat < EXPECTED == stdout == db == NULL: 0 @@ -952,4 +952,26 @@ db == NULL: 1 EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "open: database parameter overrides implicit config" +test_subtest_known_broken +notmuch config set database.path ${MAIL_DIR}/nonexistent +cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} + const char *path = NULL; + notmuch_status_t st = notmuch_database_open_with_config(argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + NULL, NULL, &db, NULL); + printf ("status: %d\n", st); + path = notmuch_database_get_path (db); + printf ("path: %s\n", path ? path : "(null)"); +EOF +cat < EXPECTED +== stdout == +status: 0 +path: MAIL_DIR +db == NULL: 0 +== stderr == +EOF +notmuch_dir_sanitize < OUTPUT > OUTPUT.clean +test_expect_equal_file EXPECTED OUTPUT.clean + test_done -- 2.33.0