Bug 263805

Summary: Generating a Key Pair In Basic Mode Never Finishes
Product: [Applications] kgpg Reporter: gorilla.maguilla
Component: generalAssignee: Rolf Eike Beer <kde>
Status: RESOLVED FIXED    
Severity: normal CC: kernelpanic
Priority: NOR    
Version: 1.2.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 4.6.1
Sentry Crash Report:
Attachments: kgpg strace log

Description gorilla.maguilla 2011-01-21 02:05:50 UTC
Version:           1.2.1 (using KDE 4.5.5) 
OS:                Linux

If trying to generate a key pair with the standard dialog, not in expert mode, the process never finishes. After the last step, "Enter the passphrase" and clicking ok, the key is not generated, the program enters in an endless loop with no results and is necessary to kill the process gpg, after that kgpg shows the message "gpg did not finish. Cannot generate a new key pair". During the loop gpg and kpgp show not cpu usage.

If trying in expert mode, the command driven mode works perfect.

I don't think is a problem of generating random bytes because I do the same, to generate random bytes, in basic and expert mode and in expert mode doesn't take more than 20 seconds.

Reproducible: Always

Steps to Reproduce:
Try to generate a new key pair, not in expert mode.



I'm using the 64 bits version.
Comment 1 gorilla.maguilla 2011-01-21 02:11:56 UTC
There is an error, the version is kgpg 2.4.1 in kde 4.5.5
Comment 2 Rolf Eike Beer 2011-02-19 20:37:57 UTC
Please prepare KGpg until the password is entered. Please use a fake password as this will be in the logfile later. Then go to a terminal and do:

ps -C kgpg
-> this will give you the process id of KGpg
strace -f -o kgpg.log -s 256 -p put_the_process_if_of_the_last_command_here
-> wait for some seconds until you think that KGpg was in that endless loop for sure and the key generation should have been finished. Interrupt strace (Ctrl-C). Have a look into the logfile. I suspect some short sequence of lines repeating _tons_ of times. Please reduce them to only 2 or 3 occurences. Then attach the logfile to this bug.

strace is a program you likely need to install as it's not in the default package selection of most distros.
Comment 3 gorilla.maguilla 2011-02-22 19:19:39 UTC
Created attachment 57449 [details]
kgpg strace log
Comment 4 gorilla.maguilla 2011-02-22 19:21:03 UTC
The most repetitive sequence that I could find is:

5645  poll([{fd=3, events=POLLIN}, {fd=9, events=POLLIN}, {fd=8, events=POLLIN}, {fd=5, events=POLLIN}, {fd=10, events=POLLIN}, {fd=15, events=POLLIN}, {fd=17, events=POLLIN}, {fd=21, events=POLLIN}], 8, -1) = 1 ([{fd=8, revents=POLLIN}])
5645  read(8, "\34\0\375\257}\2\0\0\210\1\0\0\3353\v\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
5645  read(8, 0x876584, 4096)           = -1 EAGAIN (Resource temporarily unavailable)
5645  read(8, 0x876584, 4096)           = -1 EAGAIN (Resource temporarily unavailable)
5645  read(8, 0x876584, 4096)           = -1 EAGAIN (Resource temporarily unavailable)

Hope it helps!
Comment 5 Rolf Eike Beer 2011-02-22 21:43:53 UTC
Yes, the log helps indeed. The chosen algorithm is not supported by GnuPG (I suspect it's the ElGamal subkey). KGpg doesn't get that and waits for a different reply. I will go and fix this up but that can take a while.
Comment 6 Rolf Eike Beer 2011-02-23 20:34:03 UTC
SVN commit 1222430 by dakon:

immediately stop if GnuPG tells us the key can not be generated

CCBUG:263805

 M  +3 -1      kgpggeneratekey.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1222430
Comment 7 Rolf Eike Beer 2011-02-23 20:35:48 UTC
SVN commit 1222431 by dakon:

backport key generation fixes

BUG:263805

backport of r1222429 and r1222430


 M  +4 -4      kgpggeneratekey.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1222431
Comment 8 Rolf Eike Beer 2011-03-23 20:54:46 UTC
*** Bug 269235 has been marked as a duplicate of this bug. ***