Bug 369274 - "expert" button on key generation dialog doesn't bring up Konsole
Summary: "expert" button on key generation dialog doesn't bring up Konsole
Status: RESOLVED FIXED
Alias: None
Product: kgpg
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Rolf Eike Beer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-24 05:44 UTC by Steven Noonan
Modified: 2016-10-11 16:21 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 16.12.0
Sentry Crash Report:


Attachments
patch (1.46 KB, patch)
2016-09-24 05:47 UTC, Steven Noonan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Noonan 2016-09-24 05:44:51 UTC
The arguments KGPG is using aren't quoted properly. It passes an argument list like this:

[ "konsole", "-e", "gpg", "--gen-key", "--expert" ]

instead of this:

[ "konsole", "-e", "gpg --gen-key --expert" ]

Reproducible: Always




This fixes it, and also uses --full-gen-key instead of --gen-key on GPG 2.1+. If we're going "expert" we might as well go all the way.

diff --git a/keysmanager.cpp b/keysmanager.cpp
index d0073da..8604063 100644
--- a/keysmanager.cpp
+++ b/keysmanager.cpp
@@ -507,11 +507,17 @@ void KeysManager::slotGenerateKey()
                        KConfigGroup config(KGlobal::config(), "General");
 
                        QString terminalApp(config.readPathEntry("TerminalApplication", QLatin1String( "konsole" )));
+
+                       QString gpg_args;
+                       gpg_args += KGpgSettings::gpgBinaryPath() + QLatin1String(" --expert");
+                       if (GPGProc::gpgVersion(GPGProc::gpgVersionString(QString())) > 0x20100)
+                               gpg_args += QLatin1String(" --full-gen-key");
+                       else
+                               gpg_args += QLatin1String(" --gen-key");
+
                        QStringList args;
                        args << QLatin1String( "-e" )
-                              << KGpgSettings::gpgBinaryPath()
-                                       + QLatin1String(" --full-gen-key")
-                                       + QLatin1String(" --expert");
+                            << gpg_args;
 
                        QProcess *genKeyProc = new QProcess(this);
                        genKeyProc->start(terminalApp, args);
Comment 1 Steven Noonan 2016-09-24 05:47:34 UTC
Created attachment 101253 [details]
patch

My copy/pasted diff had a missing include. Also the formatting was ugly. Attaching a patch instead.
Comment 2 Rolf Eike Beer 2016-10-01 11:30:43 UTC
It works for me even without the patch, what is your setup? Konsole version etc.?
Comment 3 Steven Noonan 2016-10-01 11:58:38 UTC
$ konsole --version
konsole 16.08.1

Example of how kgpg currently invokes konsole:
$ konsole -e gpg --gen-key --expert
Unknown options: gen-key, expert.

How it should be quoting:
$ konsole -e "gpg --gen-key --expert"
<brings up Konsole with gpg key generation prompts>
Comment 4 Rolf Eike Beer 2016-10-11 16:20:40 UTC
Could be plasma-related, as I can reproduce it on a machine with Plasma 5.
Comment 5 Rolf Eike Beer 2016-10-11 16:21:29 UTC
Git commit af3b40cbb204b69f30b33777b10606a6814276c6 by Rolf Eike Beer, on behalf of Steven Noonan.
Committed on 11/10/2016 at 16:16.
Pushed by dakon into branch 'master'.

slotGenerateKey: correctly invoke GPG for interactive key generation

While at it, use --full-gen-key if the given GnuPG binary is new enough.
FIXED-IN:16.12.0

Signed-off-by: Steven Noonan <steven@uplinklabs.net>

M  +10   -3    keysmanager.cpp

http://commits.kde.org/kgpg/af3b40cbb204b69f30b33777b10606a6814276c6