Page MenuHome GnuPG

GPGme doesn't find GPG.EXE
Closed, ResolvedPublic

Description

Release: gpgme 1.1.2 in GPG4win's GPGol (according to its released source)

Environment

x86, WinXP

Description

Problem posted at http://wald.intevation.org/forum/forum.php?thread_id=94&forum_id=21

The code of "_gpgme_get_gpg_path()" in "w32-util.c" searches for a GPG regkey named "gpgProgram" in "Software\GNU\GnuPG" of HKCU and HKLM, but this key is no more available since GnuPG 1.41, so GPGme defaults to "%program_files%\GNU\GNUPG".
So if you a user doesn't install into the default directory then GPG.EXE will not be found.

How To Repeat

Clean system of GnuPG (remove all reg keys), clean install of GnuPG 1.4.3 in *non-default* path (e.g. D:\GnuPG), let GPGme try to find GPG.EXE, e.g. via GPG4win's GPGol, etc.

Fix

Possible code solutions:
a) GPGme should try the regkey "Install Directory" plus "\bin" to find GPG.exe
b) Call "gpg.exe" without any path, as the correct GPG folder should be always in a user's path, isn't it?
c) Maybe different ways to determine the path depending on the version
d) Does another function provide this info similar to the GPG name (gpg->filename)?

Event Timeline

werner added a subscriber: werner.

Not a bug and no reason to change it.

This is by design. In general a standard location is the best
solution. However for testing etc a way to override it is usefule.
Thus we still support gpgProgram to locate the gpg binary.

Regarding solution b): gpg is not by default in the users PATH thus this is not an option.

I don't understand d).

From: Werner Koch <wk@gnupg.org>
To: Matthias Buecher / Germany <maddes.b@arcor.de>
Cc: bug-any@bugs.gnupg.org, Marcus Brinkmann <marcus@g10code.com>
Subject: Re: gpgme/668
Date: Fri, 30 Jun 2006 14:54:56 +0200

On Wed, 28 Jun 2006 23:19, Matthias Buecher / Germany said:

If the registry key was just a hack, how about an environment variable
named GNUPGBIN?

It does not make sense. An environment variable is basically the same
as an registry entry.

This way everybody can easily define and check which gpg binary is
used, similar to the usage of GNUPGHOME.

There should be only one gpg binary on a system - why do you want
different ones? And if you wneed one for exprmineting or whatever,
there are means of doing so.

Shalom-Salam,

Werner

From: Matthias Buecher / Germany <maddes.b@arcor.de>
To: bug-any@bugs.gnupg.org
Cc: Werner Koch <wk@gnupg.org>, Marcus Brinkmann <marcus@g10code.com>
Subject: Re: gpgme/668
Date: Wed, 28 Jun 2006 23:19:13 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the registry key was just a hack, how about an environment variable
named GNUPGBIN?
This way everybody can easily define and check which gpg binary is
used, similar to the usage of GNUPGHOME.

Regards
Maddes

On 27.06.2006 16:25, Werner Koch wrote:

On Mon, 26 Jun 2006 20:14, Matthias Buecher / Germany said:

The support of "HKxx\Software\GNU\GnuPG\gpgProgram" is really
nice, but unfortunately this reg entry is no more created by the
GnuPG installer since 1.4.1.

It has always been a kludge and thus it is removed.

If it is intended to use this registry entry by design, then the
GnuPG installer should always set it.

No, it is not intended.

Then this issue is also more a GnuPG installer bug rather than a
GPGme bug.

If you need to use a different gpg binary for your application you
may use the gpgme_set_engine_info API to specify that.

Shalom-Salam,

Werner

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEovJRUXXT+9wZdbURArA3AKC3bOwTFrAaszAnYaZVOzwdZjWBmACfZGno
6+hQ3d+RZgCa8q5ZiH1DCCM=

4J8l

-----END PGP SIGNATURE-----

From: Matthias Buecher / Germany <maddes.b@arcor.de>
To: Werner Koch <wk@gnupg.org>
Cc: bug-any@bugs.gnupg.org, Marcus Brinkmann <marcus@g10code.com>
Subject: Re: gpgme/668
Date: Fri, 30 Jun 2006 23:38:19 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again,

there is a misunderstanding. I do *not* want or have multiple gpg
binaries on my system.

The problem is that if someone installs GnuPG into a non-default
directory, then software that uses GPGme (like GPGol) can't find
GnuPG, resulting in a confusing error message (e.g. "invalid
crypto-engine").
This message doesn't reveal any useful information and doesn't point
to the problem of being unable to find GnuPG.

#1 better information for the user
(I haven't checked if the message is generated inside GPGme or GPGol)
An error message that tells the user to use the registry hack for
installations in a non-default directory would be fine.
People won't get helpless or even upset, as they are pointed to both
solutions: install in default directory or use the registry "hack".

Even I was totally confused by this message, as GnuPG worked like a
charm for me with Thunderbird/Enigmail and GPGshell.
As I'm a programmer I know how to read code and found myself a
solution, but normal people won't do that.

#2 easier flexibility
For advanced users like us, who tend to configure their system in
their own way, it's easy to create this registry key.
But for a normal user, that needs/wants to install GnuPG somewhere
else for any reason, will get problems.
Hence I suggested to use an environment variable (GNUPGBIN).

Env vars are easy to access/create in Windows, even without admin rights.
An env var would also be consistent with GNUPGHOME, which I definitely
use and most of my friends too.
And env vars are common to *nix users too, who have to use Windows
from time to time.

You can say that this is not a real bug, as there is a way to use
GPGme-based software with GnuPG in a non-default directory via the regkey.
But it's an inconvenient problem, because the current way needs
registry editing which my cause authorization problems (e.g. not
allowed to run RegEdit, etc.), and it's nowhere described (beside the
code itself). So even advanced users get in trouble with this.

(Personal opinion) To make encryption and especially GnuPG more
popular, the software should be able to adopt to the user and not the
other way round.
This is not easy, because as a programmer your eyes keep looking on
the technical/logic side of the application.
I have to remind myself every day at work to consider the user side
when coding.

Regards and thanks for your patience
Maddes

On 30.06.2006 14:54, Werner Koch wrote:

On Wed, 28 Jun 2006 23:19, Matthias Buecher / Germany said:

If the registry key was just a hack, how about an environment
variable named GNUPGBIN?

It does not make sense. An environment variable is basically the
same as an registry entry.

This way everybody can easily define and check which gpg binary
is used, similar to the usage of GNUPGHOME.

There should be only one gpg binary on a system - why do you want
different ones? And if you wneed one for exprmineting or whatever,
there are means of doing so.

Shalom-Salam,

Werner

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEpZnLUXXT+9wZdbURAnRLAJ9Tzr7a5zG0uLbd09caKRI7bs7NvQCgldz2
KuY48EkVlKAdP3YY7x5yKL0=

oNVj

-----END PGP SIGNATURE-----

werner added a project: Not A Bug.
werner removed a project: Restricted Project.