Re: [PATCH 6/9] search for a reasonable gpg implementation
On Thu, Dec 10 2015, Daniel Kahn Gillmor wrote: > When the notmuch database needs to find gpg, have it search reasonable > paths first. > --- > lib/database.cc | 13 - > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/lib/database.cc b/lib/database.cc > index 62bc6d9..d0e8800 100644 > --- a/lib/database.cc > +++ b/lib/database.cc > @@ -2393,6 +2393,17 @@ _notmuch_database_link_message (notmuch_database_t > *notmuch, > return status; > } > > +static const char* > +_notmuch_database_get_gpg_path (notmuch_database_t *notmuch) > +{ > +#define try_gpg_path(z) if (!access(z, X_OK)) return z > +try_gpg_path("/usr/bin/gpg2"); > +try_gpg_path("/bin/gpg2"); > +try_gpg_path("/usr/bin/gpg"); > +try_gpg_path("/bin/gpg"); > +return NULL; > +} If this were to survive longer, BSD folks would like to have /usr/local/bin checked... (i don't know (yet) about os x ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH 6/9] search for a reasonable gpg implementation
On 12/11/15 3:56 PM, Tomi Ollila wrote: >> +static const char* >> +_notmuch_database_get_gpg_path (notmuch_database_t *notmuch) >> +{ >> +#define try_gpg_path(z) if (!access(z, X_OK)) return z >> +try_gpg_path("/usr/bin/gpg2"); >> +try_gpg_path("/bin/gpg2"); >> +try_gpg_path("/usr/bin/gpg"); >> +try_gpg_path("/bin/gpg"); >> +return NULL; >> +} > > If this were to survive longer, BSD folks would like to have > /usr/local/bin checked... > (i don't know (yet) about os x I'm not following closely, but seeing paths to programs hard coded in the source never seems like a good idea; invariably someone will have the program in an unanticipated location. I'm using pkgsrc on OS X, and my gpg is at /opt/pkg/bin/gpg. How about a Notmuch configuration file item specifying the location of the program? Or if not that, how about a configuration option at build time to specify the location of gpg that then gets hard coded in the source? Or if not that, how about an environment variable that will specify the location of the program (e.g. like OpenSSH's SSH_ASKPASS environment variable)? Regards, Lewis ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH 6/9] search for a reasonable gpg implementation
On Fri 2015-12-11 17:18:52 -0500, J. Lewis Muir wrote: > On 12/11/15 3:56 PM, Tomi Ollila wrote: >>> +static const char* >>> +_notmuch_database_get_gpg_path (notmuch_database_t *notmuch) >>> +{ >>> +#define try_gpg_path(z) if (!access(z, X_OK)) return z >>> +try_gpg_path("/usr/bin/gpg2"); >>> +try_gpg_path("/bin/gpg2"); >>> +try_gpg_path("/usr/bin/gpg"); >>> +try_gpg_path("/bin/gpg"); >>> +return NULL; >>> +} >> >> If this were to survive longer, BSD folks would like to have >> /usr/local/bin checked... >> (i don't know (yet) about os x > > I'm not following closely, but seeing paths to programs hard coded in > the source never seems like a good idea; invariably someone will have > the program in an unanticipated location. I'm using pkgsrc on OS X, > and my gpg is at /opt/pkg/bin/gpg. How about a Notmuch configuration > file item specifying the location of the program? Or if not that, how > about a configuration option at build time to specify the location of > gpg that then gets hard coded in the source? Or if not that, how about > an environment variable that will specify the location of the program > (e.g. like OpenSSH's SSH_ASKPASS environment variable)? Yes, the path search is genericized later in the series (7/9). clearly i should have done even more commit squashing to avoid confusing people with this distraction. point clearly taken, though; i will avoid hard-coding any paths. thanks! --dkg ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch