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 ms11 with LMTPS id mMzbD6cCnl6sYwAA0tVLHw (envelope-from ) for ; Mon, 20 Apr 2020 20:14:31 +0000 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 N1t3NKwCnl6LTAAAbx9fmQ (envelope-from ) for ; Mon, 20 Apr 2020 20:14:36 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 604589419DF for ; Mon, 20 Apr 2020 20:14:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 55A986DE0F39; Mon, 20 Apr 2020 13:14:29 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zVrWAIIdGHj8; Mon, 20 Apr 2020 13:14:28 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 7D5806DE0F54; Mon, 20 Apr 2020 13:14:26 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 5BA9E6DE0F07 for ; Sun, 19 Apr 2020 11:54:14 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gH8sDZxzAtg3 for ; Sun, 19 Apr 2020 11:54:13 -0700 (PDT) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by arlo.cworth.org (Postfix) with ESMTPS id 664046DE0E7F for ; Sun, 19 Apr 2020 11:54:13 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id j14so6039894lfg.9 for ; Sun, 19 Apr 2020 11:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=xlPkv5z8lZTVvPCVB5IBgztGBqqI4DyPLtzhZ804gqo=; b=XsZHTsdvy3JOE8gnSTFbtd1SHMeMdbbitu1DUsGs5NSFmLu+W/7lQ9HLm8QFlXKm5S WKJPybZLfnk9MaCpmlvWnBAdA44FU1x6tDcEUqwn1c2fJIs0xzYIu5Uk7LRV3QapfYOa ExIZ3l+eIjA0ffMndDDBIAsrmmZ/T4+fqxlclvCgUVwDsC9r9PfkfWeFL2n2djQWFxsH PRkmlzLRGBxIrmnpsqQpFWNn++j/YBTNVU637HRqtLC+yz64yu/LYTEf/dBF6koP7UVC 08/3E3VzIsMQ6CubVNyzoBKN7FvXYJNHHMVyx27kmtoInYaDjs9mFyytZQIAHPEWslKF Nw5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=xlPkv5z8lZTVvPCVB5IBgztGBqqI4DyPLtzhZ804gqo=; b=joAmStTuAyVLIBydoe5zYMsWw5DRq4o7ZeA+qiakMp8LdWb1135ngXgBH2GXdWqIlt CezfohLQLPK/zGQjaPlmtPqbbRySXzuK+hTtJUlpTZ7x2auBcXdWKnnK0sJzpWDCoAgS O3HtudFq1yvrAQBH3nEb/rL0+7RtxEZbiRR8MGyM0yjKYR5iFHQ3EmR6/46eor9uXf5+ sqiLRtM3SaNADenxGEYjiRsy3DfkUn62NnL+Pz0qvS/+kWzc1xQ2fE/UMSU4K6EGIm3j ISnWB+MgKs5ALtZkgpDm5/5HmMbMLRg/ZU516tuuG/X1vLsOZk4j/wCM9dL2C6lgkFwH um2Q== X-Gm-Message-State: AGi0PuYGoO91abNABWpPiiibjmkqu2pH79tRbTeU8l0fFrI99ACvJcAE HtQ95ktXh7gtH0h1AqWe+jm7nyghw8nTB49/F9/Lh1Aq4lDQlA== X-Google-Smtp-Source: APiQypL7tgizNPk1mGl2NvUpzqSZV+pcCkwcfWTCYhZOmxE71ponhKGJFlBJOM3/Ktj+jTU1ItCu0/mPgSFVOF/RxjY= X-Received: by 2002:a05:6512:14a:: with SMTP id m10mr8168644lfo.152.1587322449878; Sun, 19 Apr 2020 11:54:09 -0700 (PDT) MIME-Version: 1.0 From: Kirill Elagin Date: Sun, 19 Apr 2020 21:53:57 +0300 Message-ID: Subject: Database path discovery in bindings To: notmuch@notmuchmail.org X-Mailman-Approved-At: Mon, 20 Apr 2020 13:14:24 -0700 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============2056578885767938498==" Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 X-Spam-Score: 1.89 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=gmail.com header.s=20161025 header.b=XsZHTsdv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Scan-Result: default: False [1.89 / 13.00]; GENERIC_REPUTATION(0.00)[-0.46594820611074]; R_SPF_ALLOW(-0.20)[+a]; R_DKIM_REJECT(1.00)[gmail.com:s=20161025]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 27017(-0.19), country: US(-0.01), ip: 50.126.95.6(-0.47)]; RCVD_IN_DNSWL_MED(-0.20)[50.126.95.6:from]; DKIM_TRACE(0.00)[gmail.com:-]; CTYPE_MIXED_BOGUS(1.00)[]; MX_GOOD(-0.50)[cached: notmuchmail.org]; MAILLIST(-0.20)[mailman]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:~,4:+]; DATE_IN_PAST(1.00)[]; ASN(0.00)[asn:27017, ipnet:50.126.64.0/18, country:US]; FROM_NEQ_ENVFROM(0.00)[kirelagin@gmail.com,notmuch-bounces@notmuchmail.org]; ARC_NA(0.00)[]; URIBL_BLOCKED(0.00)[notmuchmail.org:email]; FROM_HAS_DN(0.00)[]; SPF_REPUTATION_HAM(0.00)[-0.45865799129544]; MIME_GOOD(-0.10)[multipart/mixed,multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[notmuch@notmuchmail.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_SEVEN(0.00)[8]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed),none] X-TUID: LarWGErUD0px Content-Transfer-Encoding: 7bit --===============2056578885767938498== Content-Type: multipart/alternative; boundary="000000000000c4eedc05a3a94efa" --000000000000c4eedc05a3a94efa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, Notmuch contains a bit of logic for =E2=80=9Cnormalising=E2=80=9D the datab= ase path: it can be relative to $HOME and fallsback to $MAILDIR or $HOME/mail. However, this logic is implemented in `notmuch_config_open` and is not available through bindings. So if a third-party tool wants to discover the database, it will either do this incorrectly ([alot]) or will have to roll its own implementation ([afew]). Neither option is good. [alot]: https://github.com/pazz/alot/issues/1396 [afew]: https://github.com/afewmail/afew/pull/233 Rather than reimplementing it in bindings, I see two possible solutions: 1. Move the logic to `notmuch_database_open` itself. 2. Extract into a separate C function, use it in `notmuch_config_open`, and expose through bindings. What do you think? Cheers, Kirill --000000000000c4eedc05a3a94efa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

Notmuch contains a bi= t of logic for =E2=80=9Cnormalising=E2=80=9D the database path: it can be r= elative to $HOME and fallsback to $MAILDIR or $HOME/mail. However, this log= ic is implemented in `notmuch_config_open` and is not available through bi= ndings. So if a third-party tool wants to discover the database, it will ei= ther do this incorrectly ([alot]) or will have to roll its own implementati= on ([afew]). Neither option is good.

=
Rather than reimplementing it in bindings, I see two possibl= e solutions:

1. Move the logic to `notmuch_databas= e_open` itself.
2. Extract into a separate C function, use it in = `notmuch_config_open`, and expose through bindings.

What do you think?

Cheers,
= Kirill
--000000000000c4eedc05a3a94efa-- --===============2056578885767938498== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============2056578885767938498==--