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 963B96DE13EF for ; Fri, 11 Dec 2015 14:25:17 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.014 X-Spam-Level: X-Spam-Status: No, score=-0.014 tagged_above=-999 required=5 tests=[AWL=-0.014] 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 THjZOwSQHXIq for ; Fri, 11 Dec 2015 14:25:16 -0800 (PST) Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108]) by arlo.cworth.org (Postfix) with ESMTP id 097696DE005F for ; Fri, 11 Dec 2015 14:25:16 -0800 (PST) Received: from fifthhorseman.net (unknown [38.109.115.130]) by che.mayfirst.org (Postfix) with ESMTPSA id 237BCF984; Fri, 11 Dec 2015 17:25:15 -0500 (EST) Received: by fifthhorseman.net (Postfix, from userid 1000) id 41B421FF87; Fri, 11 Dec 2015 17:25:15 -0500 (EST) From: Daniel Kahn Gillmor To: Tomi Ollila , 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> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 11 Dec 2015 17:25:15 -0500 Message-ID: <87mvtgfws4.fsf@alice.fifthhorseman.net> 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: Fri, 11 Dec 2015 22:25:17 -0000 On Fri 2015-12-11 17:02:33 -0500, Tomi Ollila wrote: > The above code finds gpg/gpg2 (when called w/ these args) from > _CS_PATH (seems to be /bin:/usr/bin by default in linux (tried to > look how this set in *BSD -- initially it looks like /usr/local/bin > not included but... maybe we let them to complain if this is the case > ... :/) > ... anyway, the full found path is not set anywhere -- how is it found > when used (exec*p() using $PATH? :O) Hm, according to exec(3): Special semantics for execlp() and execvp() The execlp(), execvp(), and execvpe() functions duplicate the actions of the shell in searching for an executable file if the specified filename does not contain a slash (/) character. The file is sought in the colon-separated list of directory pathnames specified in the PATH environment variable. If this variable isn't defined, the path list defaults to the current directory followed by the list of directories returned by confstr(_CS_PATH). (This confstr(3) call typically returns the value "/bin:/usr/bin".) So this code probably also ought to be searching $PATH as well. yuck. You'd think there would be a commonly-available function for doing this specific check without having to actually try to exec() something. --dkg