Bug 433112 - plasma-pass assumes the gnupg version by the executable name
Summary: plasma-pass assumes the gnupg version by the executable name
Status: RESOLVED FIXED
Alias: None
Product: plasma-pass
Classification: Plasma
Component: General (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Daniel Vrátil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-17 20:27 UTC by Pino Toscano
Modified: 2021-02-21 14:18 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pino Toscano 2021-02-17 20:27:35 UTC
Looking at plugin/providerbase.cpp in plasma-pass 1.2.0, I see the following:

    bool isGpg2 = true;
    auto gpgExe = QStandardPaths::findExecutable(QStringLiteral("gpg2"));
    if (gpgExe.isEmpty()) {
        gpgExe = QStandardPaths::findExecutable(QStringLiteral("gpg"));
        isGpg2 = false;
    }

This is semi-incorrect, as newer distributions (at least Debian since few years) tend to ship GnuPG 2.x as "gpg", with the old GnuPG 1.x as "gpg1". IMHO there ought to be a proper version check based on the executable itself, i.e. parsing the output of `$gpgExe --version`.
Comment 1 Daniel Vrátil 2021-02-21 11:42:47 UTC
Ideally I would like to use libgpgme, not sure why I did not use it in the first place...
Comment 2 Daniel Vrátil 2021-02-21 14:18:24 UTC
Git commit b6ae9e8a7224efde8bfcca0c6216dfa4e273fb23 by Daniel Vrátil.
Committed on 21/02/2021 at 14:17.
Pushed by dvratil into branch 'master'.

Use QGpgme library to interact with GPG

Use a library rather than invoking the gpg executable directly.
One thing is that finding the right executable and the version
is tricky (see #433112), it makes the code more complex.
FIXED-IN: 1.3.0

M  +1    -0    CMakeLists.txt
M  +1    -0    plugin/CMakeLists.txt
M  +2    -2    plugin/otpprovider.cpp
M  +1    -1    plugin/otpprovider.h
M  +2    -2    plugin/passwordprovider.cpp
M  +1    -1    plugin/passwordprovider.h
M  +31   -49   plugin/providerbase.cpp
M  +2    -3    plugin/providerbase.h

https://invent.kde.org/plasma/plasma-pass/commit/b6ae9e8a7224efde8bfcca0c6216dfa4e273fb23