Bug 447582

Summary: Kgpg can't decrypt in editor anymore
Product: [Applications] kgpg Reporter: Rigo Wenning <rigo>
Component: generalAssignee: Rolf Eike Beer <kde>
Status: RESOLVED DUPLICATE    
Severity: major    
Priority: NOR    
Version First Reported In: 21.12.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Backtrace of crash when closing

Description Rigo Wenning 2021-12-27 17:50:17 UTC
SUMMARY
***
I have my password file crypted with gpg. I normally decrypt in the editor without saving. When switching from Opensuse tumbleweed 2021-11-05 to Opensuse tumbleweed 2021-12-24, kgpg stopped being able to decrypt the file. It still reacted on "encrypt". But the "Decyrpt" button is just dead. It is possible to decrypt the file with gpg -d in a terminal though. Only the frontend is broken.
***


STEPS TO REPRODUCE
1. Start Kgpg
2. Open an encrypted file 
3. Click on the "Decrypt" button.

OBSERVED RESULT

Nothing happens

EXPECTED RESULT
the content shown is decrypted. 

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.23.4-1.1
KDE Frameworks Version: 5.89.0-1.1
Qt Version: Name           : libQt5Core5
Version        : 5.15.2+kde268-1.1


ADDITIONAL INFORMATION
Comment 1 Rolf Eike Beer 2021-12-27 18:58:12 UTC
I suspect this may be an incompatibility with GnuPG as the KGpg code has not changed in a while. What gpg version is this?

Can you build KGpg with debug messages as described here: https://utils.kde.org/projects/kgpg/building.php and report the output of the decryption attempt?

I suspect this is related to bug 444848 at the end.
Comment 2 Rigo Wenning 2021-12-27 20:43:58 UTC
https://utils.kde.org/projects/kgpg/building.php requires libkdepimlibs4-devel while debian requires kdepimlibs5-dev. Given we are working in KF5, isn't the description for opensuse outdated?
Comment 3 Rolf Eike Beer 2021-12-27 21:01:01 UTC
It surely is. Will fix.
Comment 4 Rigo Wenning 2021-12-27 21:17:12 UTC
(In reply to Rolf Eike Beer from comment #3)
Ok, installed the necessary devel files. zypper install kdelibs4support-devel and the kgpg source compiled. But now I have no "Decrypt" button at all. kgpg-decrypt seems to be for testing. As this is not my main expertise, I'm a bit at loss what to do. There is no "decrypt" function at all when running the compiled Kgpg.
Comment 5 Rolf Eike Beer 2021-12-27 21:38:07 UTC
kgpg-decrypt is a unit test. You can run them with "make test" or "ctest" in the build directory. If it fails please attach the LastTests.log file here. Please stop any running kgpg instances and then run the kgpg from the build directory: ./kgpg -d
Comment 6 Rigo Wenning 2021-12-27 21:46:33 UTC
(In reply to Rolf Eike Beer from comment #5)
I have run kgpg from the build directory. I opened by crypted file. There is NO BUTTON for "encrypt" or "decrypt". There is NO MENU for "encrypt" or "decrypt". Those exist in the binary from the opensuse repos, but NOT in the compiled binary. I may have done something wrong while compiling. But I followed the instructions on the page you gave.
Comment 7 Rigo Wenning 2021-12-27 21:50:03 UTC
It says: 
kf.xmlgui: cannot find .rc file "kgpgeditor.rc" for component "kgpg"
kf.xmlgui: cannot find .rc file "keysmanager.rc" for component "kgpg"
kf.xmlgui: cannot find .rc file "kgpgeditor.rc" for component "kgpg"
Comment 8 Rigo Wenning 2021-12-27 21:54:13 UTC
If I use ./kgpg -s [path-to-encrypted-file] it shows the decrypted file in the editor. IMHO, this bug has to do with the buttons and the (wild) changes in KF5 that break things. But I may also be wrong.
Comment 9 Rolf Eike Beer 2021-12-27 22:03:13 UTC
You need to copy them to the right place or set XDG_DATA_DIRS, see https://techbase.kde.org/Projects/Documentation/KDE_(health_table)#Docbook_Health_Table. Will add a link to the building page, too.
Comment 10 Rigo Wenning 2021-12-28 10:43:34 UTC
Ok, debugging output is a bit thin. The buttons work now. The encrypt button works perfectly. The decrypt button does not work. But if I quit kgpg, it starts operating the decryption but of course, then, there is a broken pipe. See below: 
kf.service.services: The desktop entry file "/usr/share/applications/org.gnome.ChromeGnomeShell.desktop" has Type= "Application" but no Exec line
kf.service.sycoca: Invalid Service :  "/usr/share/applications/org.gnome.ChromeGnomeShell.desktop"
Qt: Session management error: networkIdsList argument is NULL
Qt: Session management error: networkIdsList argument is NULL
QProcess: Destroyed while process ("/usr/bin/gpg2") is still running.
ASSERT: "decr != nullptr" in file /home/rigo/apps/kgpg/editor/kgpgtextedit.cpp, line 252
KCrash: Application 'kgpg' crashing...
gpg: encrypted with rsa4096 key, ID 7D4809884A36402B, created 2014-10-07
      "Rigo Wenning (W3C) <rigo@w3.org>"
Comment 11 Rigo Wenning 2021-12-28 11:29:52 UTC
Created attachment 144905 [details]
Backtrace of crash when closing

Here is a backtrace that was generated when trying to decrypt. Nothing happens. One closes kgpg. Kgpg asks if the file should be saved. If discarded it gives a lot of broken pipes. This time I told kgpg to save the dummy file and it crashed with the backtrace attached.
Comment 12 Rolf Eike Beer 2022-01-07 11:13:53 UTC
Git commit 2ba0dc670384fad39d126cc3ff447cc1560bd6b6 by Rolf Eike Beer.
Committed on 07/01/2022 at 09:52.
Pushed by dakon into branch 'master'.

KGpg: fix package list for openSUSE

M  +1    -1    projects/kgpg/building.php

https://invent.kde.org/websites/utils-kde-org/commit/2ba0dc670384fad39d126cc3ff447cc1560bd6b6
Comment 13 Rolf Eike Beer 2022-01-07 11:14:02 UTC
Git commit f0ba9ccc78b76a2a0bdadf2847a9d3581e3a0218 by Rolf Eike Beer.
Committed on 07/01/2022 at 09:59.
Pushed by dakon into branch 'master'.

KGpg: add link regarding rc file availability

M  +8    -1    projects/kgpg/building.php

https://invent.kde.org/websites/utils-kde-org/commit/f0ba9ccc78b76a2a0bdadf2847a9d3581e3a0218
Comment 14 Rolf Eike Beer 2022-01-07 12:30:37 UTC

*** This bug has been marked as a duplicate of bug 444848 ***
Comment 15 Rigo Wenning 2022-01-07 13:27:27 UTC
Hey, thanks for fixing this!