qt: Pass home directory with forward slashes when launching dirmngr

* lang/qt/src/qgpgmewkdlookupjob.cpp (startDirmngr): Replace backslashes
with forward slashes in homedir returned by GpgME::dirInfo.
--

This works around a bug which causes backslashes to be escaped (doubled)
twice on Windows, once by gpgme_op_spawn and once by the spawn helper
gpgme-w32spawn. The next versions of GnuPG 2.2 and 2.4 also have a
workaround for this.

GnuPG-bug-id: 6833
This commit is contained in:
Ingo Klöcker 2024-01-09 11:13:51 +01:00
parent d60d1b7f79
commit 7e520213c0
No known key found for this signature in database
GPG Key ID: F5A5D1692277A1E9

View File

@ -65,11 +65,13 @@ static GpgME::Error startDirmngr(Context *assuanCtx)
qCDebug(QGPGME_LOG) << "Error: Failed to get context for spawn engine (" << err.asString() << ")";
}
const auto gpgconfProgram = GpgME::dirInfo("gpgconf-name");
const auto homedir = GpgME::dirInfo("homedir");
// replace backslashes with forward slashes in homedir to work around bug T6833
std::string homedir{GpgME::dirInfo("homedir")};
std::replace(homedir.begin(), homedir.end(), '\\', '/');
const char *argv[] = {
gpgconfProgram,
"--homedir",
homedir,
homedir.c_str(),
"--launch",
"dirmngr",
NULL