[PATCH 7/9] add a gpg_path value for notmuch_database_t

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Dec 11 14:25:15 PST 2015


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


More information about the notmuch mailing list