unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
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	[thread overview]
Message-ID: <20230915125004.4129-3-david@tethera.net> (raw)
In-Reply-To: <20230915125004.4129-1-david@tethera.net>

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

  parent reply	other threads:[~2023-09-15 12:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 12:50 Report GLib errors David Bremner
2023-09-15 12:50 ` [PATCH 1/4] test: add known broken test for bad utf8 in config David Bremner
2023-09-15 12:50 ` David Bremner [this message]
2023-09-15 12:50 ` [PATCH 3/4] test: add known broken subtest for the bad config error message David Bremner
2023-09-15 12:50 ` [PATCH 4/4] Pass error message from GLib ini parser to CLI David Bremner
2023-09-23 11:47 ` Report GLib errors David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230915125004.4129-3-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).