Bug 188473 - kgpg fails to parse gnupg 2.0.10 output
Summary: kgpg fails to parse gnupg 2.0.10 output
Status: RESOLVED FIXED
Alias: None
Product: kgpg
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR major
Target Milestone: ---
Assignee: Rolf Eike Beer
URL:
Keywords:
: 194717 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-30 15:00 UTC by Andreas K. Huettel
Modified: 2009-07-12 09:08 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Initial patch for KGpg (trunk) with gpg --fixed-list-mode (9.21 KB, patch)
2009-04-07 20:23 UTC, Niels Ole Salscheider
Details
Some changes for fixed-list-mode with KGpg 1.2.2 (4.50 KB, patch)
2009-05-11 22:35 UTC, Rolf Eike Beer
Details
Some changes for fixed-list-mode with KGpg 1.2.2, version 2 (4.91 KB, patch)
2009-05-15 21:06 UTC, Rolf Eike Beer
Details
Improve parsing of fixed list mode (10.93 KB, patch)
2009-07-10 09:00 UTC, David ‘Bombe’ Roden
Details
Some changes for fixed-list-mode with KGpg 1.2.2, version 3 (11.20 KB, patch)
2009-07-12 09:08 UTC, Rolf Eike Beer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas K. Huettel 2009-03-30 15:00:32 UTC
Version:           1.2.2 (using KDE 3.5.9)
Compiler:          gcc 4.1 
OS:                Linux
Installed from:    Gentoo Packages

Since updating gnupg to version 2.0.10, kgpg fails to parse the key ring. 

Immediate symptoms: 

* error messages about invalid dates on stderr
QDate::setYMD: Invalid date 1137-89-94
QDate::setYMD: Invalid date 1044-97-30
QDate::setYMD: Invalid date 1107-69-30
...
* keylist does not display any names / e-mail addresses

(Most likely more (all?) functions are broken.)

See also the gentoo bug report:
http://bugs.gentoo.org/show_bug.cgi?id=263454
Comment 1 Andreas K. Huettel 2009-03-31 18:03:16 UTC
I'm copy-pasting this from the Gentoo bugzilla, since it contains valuable information... 

------- Comment #15 from robbat2@gentoo.org  2009-03-31 01:03 0000 -------
kgpg is not parsing the fixed-list/colon mode of gnupg correctly. In
>=app-crypt/gnupg-2.0.10, --fixed-list-mode became the default when
--with-colons was used, as the output otherwise was not well defined. If you
used --fixed-list-mode already, then the output did NOT change. If you didn't
then the output DID change.

I direct you to gnupg-2.0.9/doc/DETAILS for the output format of
fixed-list-mode.

gnupg is not broken. kgpg just fails at parsing because it never used
fixed-list-mode, and now it needs to. It's not limited to kgpg:3.5 either, I
see kgpg-4.2* is broken as well.

Of specific note to whomever goes to fix kgpg:
1. Check the format of timestamps before you try to parse them. There are _3_
valid formats. Unix epoch seconds ("192388500"), ISO8601 full
("19760205T091500") ISO8601 short date ("1976-02-05").
2. The name for the key is not available on the pub record, it must be obtained
from the uid record.
Comment 2 Niels Ole Salscheider 2009-04-07 20:20:10 UTC
I have created an initial patch today. Please review it carefully if you want to apply it since I am not very experienced with gpg.

I think that I missed something since KGPG may crash when deleting a key but it makes the main window display the correct information.
Comment 3 Niels Ole Salscheider 2009-04-07 20:23:03 UTC
Created attachment 32685 [details]
Initial patch for KGpg (trunk) with gpg --fixed-list-mode
Comment 4 Rolf Eike Beer 2009-04-11 15:33:13 UTC
Thank you for the patch. It fixes the parsing but now the main key is shown as subkey. I'll fix that and commit.
Comment 5 Rolf Eike Beer 2009-04-11 17:46:05 UTC
SVN commit 952350 by dakon:

Use --fixed-list-mode for GnuPG key output.

This is the default since GPG 2.0.10 and in general makes the life more easy. Should have been used forever.

Please test if this gives the same results as before and report back so I can backport this.

CCBUG:188473

Thanks to Niels Ole Salscheider for a patch that does the parsing of the new output format.


 M  +48 -108   kgpginterface.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=952350
Comment 6 Sylvain Demers 2009-04-28 02:43:07 UTC
I can't test the current patch since I only have KGpg 1.2.2 (KDE 3.5.9, Gentoo stable), but I will test a backport if you can provide us with one - my C++ skills are nowhere near good enough.
Comment 7 Toralf Förster 2009-05-05 11:10:33 UTC
I tried to apply that pacth against kgpg-3.5.10 at my stable Gentoo system but that failed with :

PATCH COMMAND:   patch -p3 -g0 -E --no-backup-if-mismatch < /usr/local/portage/kde-base/kgpg/files/kgpginterface.cpp.patch

===================================
patching file kgpg/kgpginterface.cpp
Hunk #1 FAILED at 464.
Hunk #2 FAILED at 514.
Hunk #3 FAILED at 523.
Hunk #4 FAILED at 531.
Hunk #5 FAILED at 551.
Hunk #6 FAILED at 571.
Hunk #7 FAILED at 583.
Hunk #8 FAILED at 591.
Hunk #9 FAILED at 608.
Hunk #10 FAILED at 649.
Hunk #11 FAILED at 657.
Hunk #12 FAILED at 702.
Hunk #13 FAILED at 722.
Hunk #14 FAILED at 738.
Hunk #15 FAILED at 747.
Hunk #16 FAILED at 1482.
16 out of 16 hunks FAILED -- saving rejects to file kgpg/kgpginterface.cpp.rej
===================================
Comment 8 Andreas K. Huettel 2009-05-05 11:14:27 UTC
Well, yes, it seems kgpg has advanced in the meantime. :)

To the authors of the patch: You could enhance your testing base a lot if you provide a patch for kde 3.5.9 or kde 3.5.10 -- these are the stable versions on Gentoo amd64 and x86, and the Gentoo crowd is fairly willing to experiment with source codes and patches... :)8

Cheers, A
Comment 9 Rolf Eike Beer 2009-05-05 12:21:18 UTC
Not marking 4.2 stable is a gentoo bug, file it there ;)

Yes, I'll look if I can do a patch fo 3.5, but yesterday was feature freeze for 4.3 (look how much gentoo is behind *g*) so I was busy doing other stuff.
Comment 10 Rolf Eike Beer 2009-05-11 22:35:25 UTC
Created attachment 33561 [details]
Some changes for fixed-list-mode with KGpg 1.2.2

I tried to backport this, but honestly, that isn't fun. You can try the patch, maybe this fixes anything. Expaning keys might work now. Everything else is probably still broken.

Please mark that version of KGpg with <=app-crypt/gnupg-2.0.9 in portage. If anyone wants to try fixing this I will help you but I will not dig into this anymore. Sorry, that code is totally different from what is in KDE4 and is scattered over several places. If you want new versions of GnuPG and anything than you should also get a new version of KDE. ;)
Comment 11 Sylvain Demers 2009-05-15 20:44:05 UTC
The 3.5 patch didn't compile for me under Gentoo amd64:

keyinfowidget.cpp: In member function ‘void KgpgKeyInfo::loadKey(QString)’:
keyinfowidget.cpp:215: error: no matching function for call to ‘KLocale::formatDate(QDateTime&)’
/usr/kde/3.5/include/klocale.h:463: note: candidates are: QString KLocale::formatDate(const QDate&, bool) const
Comment 12 Rolf Eike Beer 2009-05-15 21:06:29 UTC
Created attachment 33695 [details]
Some changes for fixed-list-mode with KGpg 1.2.2, version 2

Sorry, that somehow slipped through.
Comment 13 Sylvain Demers 2009-05-15 21:34:56 UTC
Testing report on the latest patch:

I still get the "QDate::setYMD: Invalid date" errors.

The names, emails, and expiration dates don't show (except the unlimited ones). Creation, ID, trust, and size are ok.

When expanding a key, the signatures as well as the ElGamal subkey appear ok, except that they all show a creation date of 1969-12-31.

It fits with your comment when you provided the first patch: "Expaning keys might work now. Everything else is probably still broken."  :)
Comment 14 Raimar Sandner 2009-05-24 14:13:01 UTC
The commit mentioned in Comment #5 is still not present in kde 4.2.3?
Comment 15 Rolf Eike Beer 2009-05-24 18:43:24 UTC
(In reply to comment #14)
> The commit mentioned in Comment #5 is still not present in kde 4.2.3?

Since noone verified that everything works (as requested in comment #5): no.
Comment 16 Andreas K. Huettel 2009-05-24 19:09:13 UTC
(In reply to comment #15)
> (In reply to comment #14)
> > The commit mentioned in Comment #5 is still not present in kde 4.2.3?
> 
> Since noone verified that everything works (as requested in comment #5): no.

which kind of makes sense in most cases, but not here where things can only be improved... ah well, compiling kde4 in the background...
Comment 17 Sylvain Demers 2009-05-26 21:17:12 UTC
I build a VM with Gentoo "unstable" (~amd64). Tested the patch with kgpg 4.2.2 and 4.2.3. It appears to work fine, with one exception. With the patch, kgpg 4.2.2 crashes if I use the keyserver dialog to search for a non-existing key ("lllllinux"). I could not make it crash without the patch.

4.2.3 looks fine, however.
Comment 18 Rolf Eike Beer 2009-05-26 22:22:22 UTC
There were some keyserver fixes in 4.2.3 but I still can't see why this patch would have any effect as it doesn't touch any keyserver code. Please send me a complete backtrace (send it directly to me, it does not belong to this bug). Thanks for testing anyway. Backport is on the way.
Comment 19 Rolf Eike Beer 2009-05-26 22:26:11 UTC
SVN commit 973317 by dakon:

Use --fixed-list-mode for GnuPG key output.

This is the default since GPG 2.0.10 and in general makes the life more easy.
Should have been used forever. Without this KGpg will not show useful output 
when someone uses recent GPG.

Backport of r952350 from trunk

BUG:188473


 M  +48 -108   kgpginterface.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=973317
Comment 20 Rolf Eike Beer 2009-05-31 10:19:16 UTC
*** Bug 194717 has been marked as a duplicate of this bug. ***
Comment 21 David ‘Bombe’ Roden 2009-07-10 09:00:40 UTC
Created attachment 35216 [details]
Improve parsing of fixed list mode

This patch applies to kgpg-3.5.10. I’m not 100% sure it covers all possibilities but at least my kgpg shows sensible information again. :)
Comment 22 Rolf Eike Beer 2009-07-10 21:01:56 UTC
Thanks, I'll look into it the next days.
Comment 23 Rolf Eike Beer 2009-07-12 09:08:07 UTC
Created attachment 35244 [details]
Some changes for fixed-list-mode with KGpg 1.2.2, version 3

This is an attempt to merge our versions and keep the differences in KeyView::refreshkeylist() smaller. Since I currently can't link the binary it's only compile tested.