Re: [PATCH 7/9] add a gpg_path value for notmuch_database_t
authorJ. Lewis Muir <jlmuir@imca-cat.org>
Fri, 11 Dec 2015 22:35:58 +0000 (16:35 +1800)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:50:11 +0000 (14:50 -0700)
ec/8a7aa6b6db226684ee7af6d882a2ff9f329df5 [new file with mode: 0644]

diff --git a/ec/8a7aa6b6db226684ee7af6d882a2ff9f329df5 b/ec/8a7aa6b6db226684ee7af6d882a2ff9f329df5
new file mode 100644 (file)
index 0000000..b7cec3e
--- /dev/null
@@ -0,0 +1,91 @@
+Return-Path: <jlmuir@imca-cat.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 814CF6DE0A9A\r
+ for <notmuch@notmuchmail.org>; Fri, 11 Dec 2015 14:36:00 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.139\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.139 tagged_above=-999 required=5 tests=[AWL=0.139]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id L32bFP3CZx9M for <notmuch@notmuchmail.org>;\r
+ Fri, 11 Dec 2015 14:35:59 -0800 (PST)\r
+Received: from tuna.imca.aps.anl.gov (tuna.imca.aps.anl.gov [164.54.200.33])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 00AFD6DE005F\r
+ for <notmuch@notmuchmail.org>; Fri, 11 Dec 2015 14:35:58 -0800 (PST)\r
+Received: from mink.imca.aps.anl.gov (seal.imca.aps.anl.gov [164.54.200.39])\r
+ by tuna.imca.aps.anl.gov (Postfix) with ESMTP id 561C52005F;\r
+ Fri, 11 Dec 2015 16:35:58 -0600 (CST)\r
+Subject: Re: [PATCH 7/9] add a gpg_path value for notmuch_database_t\r
+To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,\r
+ Notmuch Mail <notmuch@notmuchmail.org>\r
+References: <1449718786-28000-1-git-send-email-dkg@fifthhorseman.net>\r
+ <1449718786-28000-8-git-send-email-dkg@fifthhorseman.net>\r
+From: "J. Lewis Muir" <jlmuir@imca-cat.org>\r
+Message-ID: <566B4FCE.30802@imca-cat.org>\r
+Date: Fri, 11 Dec 2015 16:35:58 -0600\r
+MIME-Version: 1.0\r
+In-Reply-To: <1449718786-28000-8-git-send-email-dkg@fifthhorseman.net>\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 7bit\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 11 Dec 2015 22:36:00 -0000\r
+\r
+On 12/9/15 9:39 PM, Daniel Kahn Gillmor wrote:\r
+> +static notmuch_bool_t\r
+> +_find_in_path(const char* path)\r
+> +{\r
+> +    char *c = NULL, *save = NULL, *tok;\r
+> +    size_t n;\r
+> +    int dfd = -1;\r
+> +    notmuch_bool_t ret = FALSE;\r
+> +\r
+> +    n = confstr(_CS_PATH, NULL, 0);\r
+> +    c = (char*)talloc_size(NULL, n);\r
+> +    if (!c)\r
+> +    return FALSE;\r
+> +    confstr(_CS_PATH, c, n);\r
+> +\r
+> +    tok = strtok_r(c, ":", &save);\r
+> +    while (tok) {\r
+> +    dfd = open(tok, O_DIRECTORY | O_RDONLY);\r
+> +    if (dfd != -1) {\r
+> +        if (!faccessat(dfd, path, X_OK, 0)) {\r
+> +            ret = TRUE;\r
+> +            goto done;\r
+> +        }\r
+> +        close(dfd);\r
+> +    }\r
+> +    tok = strtok_r(NULL, ":", &save);\r
+> +    }\r
+> +done:\r
+> +    if (dfd != -1)\r
+> +    close(dfd);\r
+> +    if (c)\r
+> +    talloc_free(c);\r
+> +    return ret;\r
+> +}\r
+\r
+I guess I still don't get it.  Why even have a _find_in_path function?\r
+Why not just expect the gpg executable path to have already been\r
+specified somehow (e.g. Notmuch configuration file, build-time constant,\r
+or environment variable)?\r
+\r
+Regards,\r
+\r
+Lewis\r