From: Tomi Ollila Date: Sun, 13 Dec 2015 11:17:07 +0000 (+0200) 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=997fa2b399ebe20b99eb789ab598573b9cb7e53e;p=notmuch-archives.git Re: [PATCH 7/9] add a gpg_path value for notmuch_database_t --- diff --git a/96/aefea0874652de3490a9d317ef5a1cea316852 b/96/aefea0874652de3490a9d317ef5a1cea316852 new file mode 100644 index 000000000..24d9a9cc6 --- /dev/null +++ b/96/aefea0874652de3490a9d317ef5a1cea316852 @@ -0,0 +1,114 @@ +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 3314D6DE0AC2 + for ; Sun, 13 Dec 2015 03:16:54 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.693 +X-Spam-Level: +X-Spam-Status: No, score=0.693 tagged_above=-999 required=5 tests=[AWL=0.041, + SPF_NEUTRAL=0.652] 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 xxMkzYAHydos for ; + Sun, 13 Dec 2015 03:16:52 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by arlo.cworth.org (Postfix) with ESMTP id 569316DE005F + for ; Sun, 13 Dec 2015 03:16:52 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 2BB7A10005A; + Sun, 13 Dec 2015 13:17:07 +0200 (EET) +From: Tomi Ollila +To: David Bremner , + Daniel Kahn Gillmor , + Notmuch Mail +Subject: Re: [PATCH 7/9] add a gpg_path value for notmuch_database_t +In-Reply-To: +References: <1449718786-28000-1-git-send-email-dkg@fifthhorseman.net> + <1449718786-28000-8-git-send-email-dkg@fifthhorseman.net> + <87mvtgfws4.fsf@alice.fifthhorseman.net> + <87d1ubdu0k.fsf@zancas.localnet> +User-Agent: Notmuch/0.21+32~g73439f8 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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: Sun, 13 Dec 2015 11:16:54 -0000 + +On Sun, Dec 13 2015, Tomi Ollila wrote: + +> On Sun, Dec 13 2015, David Bremner wrote: +> +>> +>> Without weighing in on the advisibility of searching for gpg in $PATH, +>> there is a glib function g_find_program_in_path. We're already linking +>> to glib (because of gmime mainly, but it's used other places as well). +> +> glib2-2.38 (glib/gutils.c) seems to look in PATH, and if +> g_getenv ("PATH") == NULL uses hardcoded path "/bin:/usr/bin:."; +> (it us "security" feature to have '.' last...) +> +> If rest is TL;DR; I'd suggest we use this... since libgpgme has implemented +> it IMO too late for use in 2016 (or do additional compat function?) + +Actually now that I sent this mail it kept rolling on my mind... If anyone +else than me (and libgpgme?) thinks that '.' should not be in search path +we could do + +if (getenv("PATH") == NULL) { + path_set = true; + setenv("PATH", "/bin:/usr/bin", 1); // XXX *BSD configurability // +} +else path_set = false; + +... g_find_program_in_path("gpg2") +... g_find_program_in_path("gpg") + +if (path_set) { + unsetenv("PATH"); + +--- + +I also thought of examining the return value starting with ./ but +(current or) future version of g_find_program_in_path() might +canonicalize the returned path... + + +Tomi + + +> +>> The other point that occurs to me is that libgpgme solves this same +>> problem in src/posix-util.c. It also seems to search path, at least +>> optionally, although only if it cannot find gpgconf. +> +> On Fedora 20 I looked gpgme-1.3.2 sources -- in there I could not find +> this search using PATH... gpg-1.3.2 is released 2012-05-02... +> +> Jessie (lib)gpgme 1.5.1 (2014-07-30) seems to have the code David mentioned... +> (btw. I was suprisingly hard to search Debian packages; IIRC it was easier) +> +> Ubuntu 14.04 LTS has (lib)gpgme 1.4.3 (ubuntu5). I did not download that +> source... but 1.5.1 NEWS indicates that this PATH search has arrived to +> 1.5.0 (2014-05-21) +> +> This search is different from glib2-version that if getenv("PATH") == NULL +> search only "/bin:/usr/bin"