From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yBdlJOsBVmEm6gAAgWs5BA (envelope-from ) for ; Thu, 30 Sep 2021 20:28:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 2N/6H+sBVmE2BwAAbx9fmQ (envelope-from ) for ; Thu, 30 Sep 2021 18:28:59 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (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 17D9929082 for ; Thu, 30 Sep 2021 20:28:59 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id C45FB26DDC; Thu, 30 Sep 2021 14:28:47 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id EEF4720364 for ; Thu, 30 Sep 2021 14:28:42 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id E54C75FD5D; Thu, 30 Sep 2021 14:28:42 -0400 (EDT) Received: (nullmailer pid 4125044 invoked by uid 1000); Thu, 30 Sep 2021 18:28:41 -0000 From: David Bremner To: David Bremner , notmuch@notmuchmail.org, Ciprian Dorin Craciun Subject: [PATCH 2/2] lib/config: use g_key_file_get_string to read config values Date: Thu, 30 Sep 2021 15:28:35 -0300 Message-Id: <20210930182835.4125022-2-david@tethera.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210930182835.4125022-1-david@tethera.net> References: <20210930171748.4044617-2-david@tethera.net> <20210930182835.4125022-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: LMQJV3TTTAZVPMMOIKPEKQGXSJDTXL3J X-Message-ID-Hash: LMQJV3TTTAZVPMMOIKPEKQGXSJDTXL3J 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=1633026539; 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-unsubscribe:list-subscribe:list-post; bh=qx1lNT0Roap2v2BvgDbYlxXfwhr1RwGFKfcsnrgCqfM=; b=FHAUzrLOBWp5mP7RC9N367vIQAxRsRtPKzgyblhyVtgp9L9WD8tvrZV9v7eHi4LOF1ALgx AlWpTSiuC4lEIMy3AXjG+PkzzFB5syjt8xGQlK5pETgfsV8cyq3ikjXSRMJQfjv20wgsAS TvcnTnHYerSkNdW8yz/flaDyIpwVkAE45Azg1wV9VvUttQAYwNffPfIx5c1trk/fjNmOnt 1q6DzFYHD1t2HCeczBA+BmZiRWUsccoUn6Z8iwcOVcf0kEsNyqowBexjVeXHr96l1wnTRE dm9Xz8u0+DJL/6okAEGE4V2rfLPfXuYjFn6HYJYEJqzdzX0pMiEDO7PTHDRHig== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633026539; a=rsa-sha256; cv=none; b=m6Q/4xcjoEhkPgkxP5G4HsFxFkdVwrsuTDiOQYLf7ty6izimyWh82H7URQwbpldN2wyEix 50uxhy+sLt6c5n5svnHT9UdBhNZC78DmwkLeZb9uetDtOl4GSnbaR6XN4tJuxGiqpb0g8A KF/Y0GixV4/1AAae9BRrjfAeqfq78542fKjnK4kRM4zDK/7nc1WsLY+mBTBzLN8y/b0mqt JnbskqyTGzjKdN9sIOoJO7KsoHG3XDrEzmV2AdNeGdDGT9JLPJ8Xw6r3EkUr7bCJXxkJYy vmn1T1tCtIjZ4OgnRmJTQLeB2fcQ5MvuAGsqQpExN5IlFAAB0t9vph86AVJjnA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.16 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 17D9929082 X-Spam-Score: -1.16 X-Migadu-Scanner: scn0.migadu.com X-TUID: q1OcPaRBA3N/ Unlike the previous g_key_file_get_value, this version processes escape codes for whitespace and \. The remaining two broken tests from the last commit are because "notmuch config get" treats every value as a list, and thus the previously introduces stripping of leading whitespace applies. --- lib/config.cc | 2 +- lib/open.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/config.cc b/lib/config.cc index 8775b00a..d57240d1 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -427,7 +427,7 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch, for (gchar **keys_p = keys; *keys_p; keys_p++) { char *absolute_key = talloc_asprintf (notmuch, "%s.%s", *grp, *keys_p); char *normalized_val; - val = g_key_file_get_value (file, *grp, *keys_p, NULL); + val = g_key_file_get_string (file, *grp, *keys_p, NULL); if (! val) { status = NOTMUCH_STATUS_FILE_ERROR; goto DONE; diff --git a/lib/open.cc b/lib/open.cc index 8a835e98..0f44b858 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -199,7 +199,7 @@ _choose_database_path (void *ctx, } if (! *database_path && key_file) { - char *path = g_key_file_get_value (key_file, "database", "path", NULL); + char *path = g_key_file_get_string (key_file, "database", "path", NULL); if (path) { if (path[0] == '/') *database_path = talloc_strdup (ctx, path); @@ -637,7 +637,7 @@ notmuch_database_create_with_config (const char *database_path, if (key_file && ! split) { char *mail_root = notmuch_canonicalize_file_name ( - g_key_file_get_value (key_file, "database", "mail_root", NULL)); + g_key_file_get_string (key_file, "database", "mail_root", NULL)); char *db_path = notmuch_canonicalize_file_name (database_path); split = (mail_root && (0 != strcmp (mail_root, db_path))); -- 2.33.0