From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 4LveIAIzlWDAUAEAgWs5BA (envelope-from ) for ; Fri, 07 May 2021 14:30:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id cHiqHAIzlWAHKwAA1q6Kng (envelope-from ) for ; Fri, 07 May 2021 12:30:58 +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 7CA88140F5 for ; Fri, 7 May 2021 14:30:57 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 3CE2F2717A; Fri, 7 May 2021 08:30:54 -0400 (EDT) Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [185.185.170.37]) by mail.notmuchmail.org (Postfix) with ESMTPS id BC6B02716D for ; Fri, 7 May 2021 08:30:51 -0400 (EDT) Received: from guru.guru-group.fi (unknown [IPv6:2a02:2380:1:9:5054:ff:feb7:a4bc]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: too) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id B1DAC1B00CC7; Fri, 7 May 2021 15:30:50 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1620390650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lNpaBLkjvYm3S7yWABA0Avk8wmtaC4G9rg/66Vrgz6M=; b=etWVigLguCh6dE0sPGdaWzjYvL6/Voey/0R18JcU12VFuuGpg+WOH5yY/Cpn9vIniMa2mz gRo43xAXZ0+WVMcP2+HBxdDFCcmNcy+kR7SZvfz86uNPGtm10M3aDC6XfSBYrqXwwI8bJB 8AxDtDKyMJqRz9WXq0rJaIq6qnGDbIKkxfZ7R/+6kz3vwed5iRZX6WZcXeo8DmP4VLa/iU FFPeJs36nuL+9Nts4rlGN0dxpybabTQfxYFqqyJseJ1qSdFx8lDxN37g3eM3upG4rZnT90 BbRx1OUCi9q86RFRsSCNWgi7gogMxaFDmzeIe//0WMYtGAtEGvJnYpoAfvTsNg== From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Cc: David Bremner Subject: Re: [PATCH 4/9] lib/config: expand relative paths when reading from database In-Reply-To: <20210507113029.2685184-5-david@tethera.net> References: <20210507113029.2685184-1-david@tethera.net> <20210507113029.2685184-5-david@tethera.net> User-Agent: Notmuch/0.32+21~gfdddd4c (https://notmuchmail.org) Emacs/27.1 X-Face: HhBM'cA~ MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1620390650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lNpaBLkjvYm3S7yWABA0Avk8wmtaC4G9rg/66Vrgz6M=; b=FIOtam2hj+Rx224sFLl5IZuXg/leoztLYaRxPuesQEqYef99Q+RCtFX/ACc5mbJ06IBlFA /GR/aOsBuptpdfceJvJE3w/3Bwsfp3cmqyhPXbZ6YJ3pEIR5piOKFiYt1YPdkhk4387efb XrrchFgkEFREqLl8r7vO9NFm8yfOEwH/BqkcBUs1wPgoY1fDFOAUzzsOt+buLn0DhONcG2 rrwvHDLlusYkVSoORbDqboukO9xrR0nG5jlDollItnURe3upLTTUJlUouQ1wHGl3X8EUiE n4pLL8THagMhELLLj7G6SSTVVEc0E9pK6iu0h7sYRxI8STu1Zdjlv31kfI6WQg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=too smtp.mailfrom=tomi.ollila@iki.fi ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1620390650; a=rsa-sha256; cv=none; b=a32t6+r4FkrmJFqLIaaFKWrZtwVDqDlTS5HyPYW/wwuexcueFEv4qVvmtlPMPIRuBm7j5C ByFH0W0A9Xu96j1GUH6CFywyKcYnm9YCtnHbJReM/jnP2h7WSNplmO3rJPrT/a6JmWkEVJ opxYL3yKOo0Stn+P8cqiq6oh4Snw5gV1y/EL6a9oYUbSZ/3qJnM/9TYhHnmGWSg1m4p/Fq EGHl57xJ7KJRUXDQ3bNdIZTUScQDXEDVyNz/oxZ6+So+YlbOLORUZ1NSmKvUsQljNpp2CU wlnGgSIxb8+ubxOXyrXVdyi+Ejg4fJdLw3Mn09v819NE8VMJVYY6fqnYkfbKyQ== Message-ID-Hash: DJYRRLRHKTNEVTXIISCHQZL54ZGRVYQD X-Message-ID-Hash: DJYRRLRHKTNEVTXIISCHQZL54ZGRVYQD X-MailFrom: tomi.ollila@iki.fi 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=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620390657; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc: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:dkim-signature; bh=4cHk7EhmFwzfP5xL5l3TCZFko5knecVzaE9UOYFTw7c=; b=M10LGMP/kGJyFR+5aBLSwHbCmfuZboO8o4yH2E/dPLy9rMMols2Z9my2lSmLyL1CvEYT6o uwRJFQtcLJy3++UMMUMzGeQgOZ/gFg/W9Z2fhUxs6fqQJiLfRBr4+7A0Fj9FDIwo7SdzK+ 0TfF5PjiRLGq5aY68GArQtQpuZTpeK65i1cWZV4JD71EyP2icSaNZi8PfxqDW68H3CEXoV lPh/geIso/QkfH9OA198F1KoK4O27tLoQTHunbH7/PBroUUKPGd91BtEfmSMglnpU4yMmh FKGBQsm1eTCvSNLPzeZwZempP0adYQGpStw2sIXD7pOmg0Qk6pXWjfp24WVqCA== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1620390657; a=rsa-sha256; cv=fail; b=M4rWBJpdk0ovYHd7zxf08tMFrCuD3K6tsuKMvnpCsON7Rcfwjg+rAp+JJwW1bv7rc0Vx4d /dKpfOSDyRX6ftZjtERJSI1xyKkhj7761RiidCjG8Cy28X043oxoqtIBdDGmCsGP5aGlHV ky6tI/lES1jfYG+6FPHz1lZq+VWU20axwbIqREVG9VVLz1iEvrlv/woNBKI56PUj907CzP u0QMHMFHQfERK3rEgz/MB6ydKN3v52oq3CxK8tqICe/RC4nfnAMJ4ElCFkNVJ2ALnklscb w2qJ1o1HheMl3DZVc2pgZUaSF8zPGan9mfntrsKD1lEum36o1gQKM2w8+mMsuA== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b=etWVigLg; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}"); 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: 2.44 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b=etWVigLg; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}"); 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: 7CA88140F5 X-Spam-Score: 2.44 X-Migadu-Scanner: scn0.migadu.com X-TUID: Y7GPOwBOvX+Q On Fri, May 07 2021, David Bremner wrote: First, previous test change had the same extra space and `pwd` -> $PWD... > This makes the treatment of relative paths consistent between the > database and config files. > --- > lib/config.cc | 8 +++++--- > test/T050-new.sh | 1 - > 2 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/lib/config.cc b/lib/config.cc > index e08c6bf7..74339694 100644 > --- a/lib/config.cc > +++ b/lib/config.cc > @@ -46,6 +46,7 @@ struct _notmuch_config_pairs { > }; > > static const char *_notmuch_config_key_to_string (notmuch_config_key_t key); > +static char *_expand_path (void *ctx, const char * key, const char *val); *key > > static int > _notmuch_config_list_destroy (notmuch_config_list_t *list) > @@ -257,9 +258,10 @@ _notmuch_config_load_from_database (notmuch_database_t *notmuch) > return status; > > for (; notmuch_config_list_valid (list); notmuch_config_list_move_to_next (list)) { > - _notmuch_string_map_append (notmuch->config, > - notmuch_config_list_key (list), > - notmuch_config_list_value (list)); > + const char *key= notmuch_config_list_key (list); key = > + char *normalized_val = _expand_path (list, key, notmuch_config_list_value (list)); > + _notmuch_string_map_append (notmuch->config, key, normalized_val); > + talloc_free (normalized_val); > } > > return status; > diff --git a/test/T050-new.sh b/test/T050-new.sh > index f28497bf..dfabcf03 100755 > --- a/test/T050-new.sh > +++ b/test/T050-new.sh > @@ -407,7 +407,6 @@ rm home/Maildir > test_expect_equal_file EXPECTED OUTPUT > > test_begin_subtest "Relative mail root (in db) expanded in new" > -test_subtest_known_broken > ln -s `pwd`/mail home/Maildir that $PWD, out of changes in this message > notmuch config set --database database.mail_root Maildir > generate_message > -- > 2.30.2