From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id YBz2N+gB5mFuoAAAgWs5BA (envelope-from ) for ; Tue, 18 Jan 2022 00:55:20 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 4KGUNOgB5mHCMwAAauVa8A (envelope-from ) for ; Tue, 18 Jan 2022 00:55:20 +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) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 86DA320D32 for ; Tue, 18 Jan 2022 00:55:16 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 9EC8F5F5E3; Mon, 17 Jan 2022 23:55:08 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id E6AAE5F401 for ; Mon, 17 Jan 2022 23:55:05 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id B587C5FC03; Mon, 17 Jan 2022 18:55:04 -0500 (EST) Received: (nullmailer pid 2735645 invoked by uid 1000); Mon, 17 Jan 2022 23:55:02 -0000 From: David Bremner To: Ian , "notmuch@notmuchmail.org" Subject: [PATCH 2/2] CLI/setup: special case single item lists Date: Mon, 17 Jan 2022 19:54:53 -0400 Message-Id: <20220117235453.2735624-2-david@tethera.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117235453.2735624-1-david@tethera.net> References: <6O3LTUhoXlrnkPWCtPJCP4cagU7mFVEdyTpcC_37BoSzStlARXDBa7oczy6hB0jyjGjBQvgj_jFV58cw0aNx-jUg1h1O-FQ7820k68C0X4M=@protonmail.com> <20220117235453.2735624-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: JAQY5KGB7HQQES33VVFAQXOVIVF5OHYG X-Message-ID-Hash: JAQY5KGB7HQQES33VVFAQXOVIVF5OHYG 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=1642463716; 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=rMI0geFfjPHUn9CjLcql08eO9Ou8/v/ONd3YdvvVKQ8=; b=S/r7GDjiVuZUaeiB1sPxwtaY+VjF49U0dlAVakeUb4Qz/xcoHFrYNQ2+3KHwwS2ywCpLrP H5aEvYHkKw20fniGnO02qFpEf0W/0I0iMxZm+C12EAWZDKVmrPd5MGWKN4Y4Ah8KxPC7+a gzjnNl8OVmXm2wKXv67JAR2u712/46JO9xVX7ELncSInG47PVoZr689DVkwA5xH0SIQ7Af u08IKeYq4I7ivpZXdpeaYnUSdeuVJhBwBZ00nZ9uny5I02hMUklnuj0bMiqHq0uV3yVr9p IKWMfRULQ/w3DCEhfyxUKEuU9M3lnMTC6ejHu07+SEsPHf28wiRynfkNO7A79g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642463716; a=rsa-sha256; cv=none; b=LsX6g8brEgyeJR90/6iv3Od/+vM3H+zPv7Efq9a2qVIQZSyHgNmY30tJUJh6Q9+RKrH1nz 4rVTXRxMm64PUw0t5qmY4Jgm2dJMoAeqZra4NgskBro7lMeEHDsO2VMtMcHNmc5ChnzaZK ilm47HZJMO2fcJPTUbA4xRpk34ENB/V5t3+RYbZSXuyboLmDFrSJk5eqUPJqW17aoWyulB E/E9SPGLRLxNKMXjsTt9O+SIyv6GNeJCR9ey62Bfai30T1CFHnAZrIzJSqwZ806Y4xV+TG Jvq0Cnhlmy29zjjzRjvI4rg18IO268C0Iz4NyqXIFOm7WCzeGCgk0HmBFK0qEQ== 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.32 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: 86DA320D32 X-Spam-Score: -1.32 X-Migadu-Scanner: scn1.migadu.com X-TUID: jlyf0Bpy2z17 This matches the heuristic used by "notmuch config set" to decide if something is a list. This change fixes the bug reported at [1]. [1]: id:6O3LTUhoXlrnkPWCtPJCP4cagU7mFVEdyTpcC_37BoSzStlARXDBa7oczy6hB0jyjGjBQvgj_jFV58cw0aNx-jUg1h1O-FQ7820k68C0X4M=@protonmail.com --- notmuch-config.c | 5 ++++- test/T040-setup.sh | 1 - test/setup.expected-output/config-with-comments | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/notmuch-config.c b/notmuch-config.c index 11d8d68b..e9456d79 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -383,7 +383,10 @@ _config_set_list (notmuch_conffile_t *config, const char *list[], size_t length) { - g_key_file_set_string_list (config->key_file, group, key, list, length); + if (length > 1) + g_key_file_set_string_list (config->key_file, group, key, list, length); + else + g_key_file_set_string (config->key_file, group, key, list[0]); } void diff --git a/test/T040-setup.sh b/test/T040-setup.sh index 36a42562..10b29ec3 100755 --- a/test/T040-setup.sh +++ b/test/T040-setup.sh @@ -24,7 +24,6 @@ expected_dir=$NOTMUCH_SRCDIR/test/setup.expected-output test_expect_equal_file ${expected_dir}/config-with-comments new-notmuch-config test_begin_subtest "setup consistent with config-set for single items" -test_subtest_known_broken # note this relies on the config state from the previous test. notmuch --config=new-notmuch-config config list > list.setup notmuch --config=new-notmuch-config config set search.exclude_tags baz diff --git a/test/setup.expected-output/config-with-comments b/test/setup.expected-output/config-with-comments index 56c628e5..d8397714 100644 --- a/test/setup.expected-output/config-with-comments +++ b/test/setup.expected-output/config-with-comments @@ -31,7 +31,7 @@ path=/path/to/maildir [user] name=Test Suite primary_email=test.suite@example.com -other_email=another.suite@example.com; +other_email=another.suite@example.com # Configuration for "notmuch new" # @@ -60,7 +60,7 @@ tags=foo;bar; # query will override that exclusion. # [search] -exclude_tags=baz; +exclude_tags=baz # Maildir compatibility configuration # -- 2.34.1