Bug 245288

Summary: When signing the pinentry dialog flickers for a few seconds and then signing fails
Product: [Unmaintained] kmail Reporter: Torsten Ekedahl <teke>
Component: encryptionAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UPSTREAM    
Severity: normal CC: daniel, gleirsch, husimon, kaputtnik, montel, peter
Priority: NOR    
Version: 1.13.5   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Torsten Ekedahl 2010-07-21 08:01:53 UTC
Version:           1.13.5 (using Devel) 
OS:                Linux

When trying to send a message marked for signing, the pinentry dialog box flickers very quickly for a few seconds (so quickly so that I can only see its title) and then I get a dialog "Signing failed: Bad passphrase". If I try pinentry on the command line it works (I just give it the command GETPIN).

(I am not sure that I really use SVN or Snapshot Version. KDE reports itself as having version 4.4.5 and I have picked it up from kubuntu-ppa.)

Reproducible: Always

Steps to Reproduce:
1. Create new mail and click Sign.
2. Send mail.

Actual Results:  
Pinentry dialog box flickers back and forth between visibility and invisibility for a few seconds.

Expected Results:  
Dialog should show so that I can input password of GPG key.
Comment 1 gleirsch 2011-05-12 09:21:53 UTC
Can confirm this bug for Kubuntu 11.04 amd64
Comment 2 Franky 2011-08-20 13:52:17 UTC
confirm this Bug with KMyMoney and Konsole:

typing: echo "test" | gpg -ase -r 0x791E0AAA | gpg

will shortly display the pinentry-Dialog.
Comment 3 Franky 2011-08-20 14:20:42 UTC
Installing pinentry-gtk2 solves my Problem with KMymoney.
Comment 4 Franky 2011-08-20 19:51:23 UTC
sorry, but it works also fine with pinentry-qt4, didn't know why.
Using Kubuntu 11.04 with kde 4.6.2

You have to control:
 1. File "~/gnupg/gpg.conf" must have an entry "use-agent"
 2. File "~/gnupg/gpg-agent.conf" must have an entry "pinentry-program /usr/bin/pinentry-qt4"

IMHO thats all. There is an bug on kpgp, or gpg, or gpg-agent, while there are no default Config-Files in the Folder "~/.gnupg". In kpgp you could automatically create the configfile "~/gnupg/gpg.conf" by selecting a configfolder but accepting the default.

For me its solved :-)
Comment 5 husimon 2011-08-24 21:28:32 UTC
unfortunately, I have put my observations in the wrong thread! Sorry for that. The problem with pinentry-qt4 (input dialog window foe entering passphrase) still persists. Using Kmail alone is fine as long as I use pinentry-gtk-2 for Encryption, Signing or Decryption (of course with gpg-agent.conf setup to include the statements supplied above. The complete system break-down occurs as soon as kleoptatra is installed (its "use-agent" dependency is fixed and points to pinentry-qt4). No amount of configuration tuning helps to get the pinentry-qt4 input window to come to fore and accept any meaningful entry. The work-around to replace pinentry-qt4 with pinentry-gtk-2 fails too. As a result no encryption or decryption is possible with kleopatra installed together with kmail. I had to remove the package kleopatra to get the kmail up and running again with pinentry-gtk-2.

Kubuntu 11.04 (all updates till date installed)
KMail Version 1.13.6
under KDE Plattform-Version 4.6.2 (4.6.2)
Comment 6 Daniel Eklöf 2011-11-26 15:20:14 UTC
I had the same issue. Like others, I too had both gpg and gpg-agent correctly configured, but still it didn't work. As others have mentioned, pinentry-gtk-2 worked perfectly fine.

After lots of debugging, I found that pinentry-qt4 crashes inside ibus.

In my case, the problem was that GTK_IM_MODULE/QT_IM_MODULE/XMODIFIERS were set (to ibus) when gpg-agent was launched (by a script in .kde/env). However, at the time gpg-agent is launched, a full KDE session isn't available. For example, I don't think the session dbus has been started yet. This apparently causes problems in ibus.

I worked around the problem by modifying the gpg-agent script in .kde/env to this:

#!/bin/sh
eval `GTK_IM_MODULE="" QT_IM_MODULE="" XMODIFIERS="" gpg-agent --daemon`

With this, pinentry-qt4 no longer crashes, although it obviously means you can't use other input methods.

It does look really ugly though, as it's using some kind of default widget theme. Probably also related to the fact that gpg-agent is launched "too early".
Comment 7 Peter Wu 2012-09-05 08:51:51 UTC
This is a bus in ibus-qt, a patch is available at:
http://code.google.com/p/ibus/issues/detail?id=1504
This is not an issue of KDE, so this issue can be closed I guess.
Comment 8 Laurent Montel 2012-09-05 10:55:09 UTC
oki will close it