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