From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id UIisIBNTBGVHbwEAG6o9tA:P1 (envelope-from ) for ; Fri, 15 Sep 2023 14:50:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id UIisIBNTBGVHbwEAG6o9tA (envelope-from ) for ; Fri, 15 Sep 2023 14:50:27 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (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 72D1232725 for ; Fri, 15 Sep 2023 14:50:27 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1694782227; a=rsa-sha256; cv=none; b=GLgJFgeKzRuPOORCqHi+ao9Ne9y/Wdf62VaEyjzZboAmd8AiPXkA58Rj7p+wu2e8oaeYgx i+44V6yT240+cEtDq0/2xruN5G2H3pwH7LsQ0E5CNEbnGHBecyDXjGSD9e1cbu2t/g16b0 I2f9aFb58ZhDp5RMInE9n7OvEpz8iAgmddKpoux+/k/R0sRkNhEOlAQ1obW7mbKHlZyUHb xil9sdK3lIMbGyg6xAnjSq1Atj17BzmXKASFiIrnhTKLYVMIzdsze91vRi6mm0zF/+VxbF ViT8YFo6pHhjOzrPSVgKHbIOkNQbZszPJV9V0eXNBxBKWKzqJtbioLo6mqp5Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1694782227; 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=VtiWhYalOnsWjC71GgTA5+PYqu82acPxMGDJop53A8g=; b=R0vKn6UTTscyA2I6Z9J+jew64/CzsQWRlwk4GID/5atYs+rw+kcFmRuX08Iq7WjFzfWe3Y rbxXqeOAJXFEw0+uiM42FO8JACH+NSYeWa8Q6w4Rflt5doGpdbdwst5AyV1qaA9D650mPh 9ofBvrtxKW2m3fhnFQtNT7fBIXTsEYHN/bbC6J7pzHU+SXLJqP5ZB8x84JpiuxTNeGt3b4 w+JVXmpJRomYmj2WEHDsPQUc8NQrBquABogK2z/SLBtcRoW6Fu3SYD9ukVkXGlkDC63FkY 8w2kuhD6lDh/rFc5JHGODT17B3C/MxJ3RJjpyAdkFmFClsAEO13azFZq6yy/Hw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=none Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 3B504609EE; Fri, 15 Sep 2023 12:50:25 +0000 (UTC) Received: from phubs.tethera.net (phubs.tethera.net [192.99.9.157]) by mail.notmuchmail.org (Postfix) with ESMTPS id 93FA0609E9 for ; Fri, 15 Sep 2023 12:50:22 +0000 (UTC) Received: from tethera.net (fctnnbsc51w-159-2-210-253.dhcp-dynamic.fibreop.nb.bellaliant.net [159.2.210.253]) by phubs.tethera.net (Postfix) with ESMTPS id B2FBE180068; Fri, 15 Sep 2023 09:50:20 -0300 (ADT) Received: (nullmailer pid 4197 invoked by uid 1000); Fri, 15 Sep 2023 12:50:18 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 2/4] CLI: exit with error when load_config returns an error. Date: Fri, 15 Sep 2023 09:50:02 -0300 Message-Id: <20230915125004.4129-3-david@tethera.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230915125004.4129-1-david@tethera.net> References: <20230915125004.4129-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: 36GEKGVLCSAWMWNAO6MSOX2EEVE2GPDM X-Message-ID-Hash: 36GEKGVLCSAWMWNAO6MSOX2EEVE2GPDM 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 X-Migadu-Spam-Score: -1.25 X-Spam-Score: -1.25 X-Migadu-Queue-Id: 72D1232725 X-Migadu-Scanner: mx2.migadu.com X-TUID: qunUX7ElTuan For now print a generic error message and exit with error on any non-success code. Previously we were exiting, but with exit code zero, leading users / scripts to thing the command had succeeded. --- notmuch.c | 2 ++ test/T030-config.sh | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/notmuch.c b/notmuch.c index 37286b8f..69a18131 100644 --- a/notmuch.c +++ b/notmuch.c @@ -584,6 +584,8 @@ main (int argc, char *argv[]) case NOTMUCH_STATUS_SUCCESS: break; default: + fputs ("Error: unable to load config file.\n", stderr); + ret = 1; goto DONE; } diff --git a/test/T030-config.sh b/test/T030-config.sh index 6ef759a4..8b3ef436 100755 --- a/test/T030-config.sh +++ b/test/T030-config.sh @@ -196,7 +196,6 @@ output=$(notmuch config get built_with.nonexistent) test_expect_equal "$output" "false" test_begin_subtest "Bad utf8 reported as error" -test_subtest_known_broken cp initial-config bad-config printf '[query]\nq3=from:\xff\n' >>bad-config test_expect_code 1 "notmuch --config=./bad-config config list" -- 2.40.1