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