From 7e520213c09dc1ce4f1431e0f32054a1b7cd1368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Tue, 9 Jan 2024 11:13:51 +0100 Subject: [PATCH] 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 --- lang/qt/src/qgpgmewkdlookupjob.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lang/qt/src/qgpgmewkdlookupjob.cpp b/lang/qt/src/qgpgmewkdlookupjob.cpp index e862f293..effacfdc 100644 --- a/lang/qt/src/qgpgmewkdlookupjob.cpp +++ b/lang/qt/src/qgpgmewkdlookupjob.cpp @@ -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