Control: tag -1 + patch pending Hi Joey,
Axel Beckert wrote:
> > either since a recent apt upload or since the switch of GnuPG's default
> > version from 1.4 to 2.1, gak only shows blank values in the "owner"
> > column as well as in the owner field of the detail view.
[...]
> Actually the output of "gpg --with-colons --list-key" changed. The
> UIDs are now provided in separate lines as there can be more than one
> UID per key.
>
> I haven't written any code for that yet, but I'm confident, that I'll
> come up with a patch for this issue soon.
>
> Expect an NMU which fixes this issue and #831914 (FTBFS with
> "dpkg-buildpackage -A") from me, which I'll upload to DELAYED/n (with
> n probably being between 5 and 15). I'll post a full debdiff as soon
> as I the NMU is ready.
Attached the full source debdiff for the NMU, which I've just
uploaded(*) to DELAYED/7. Feel free to tell me if I should
fast-forward it or delay it longer.
The changelog entry reads as follows:
gui-apt-key (0.4-2.2) unstable; urgency=medium
* Non-maintainer upload
* Swap binary-* targets to fix FTBFS with "dpkg-buildpackage -A".
(closes: #831914)
* Fix empty owner with GnuPG 2.1 by also parsing "uid:" lines in
output and assigning them to the right key. (closes: #834465)
-- Axel Beckert <[email protected]> Tue, 16 Aug 2016 00:56:47 +0200
Since "gpg ... --with-colons" is used in multiple affected places and
the parsing routine got more complex (stateful), I factored out the
output parsing into its own subroutine called "parse_with_colons". The
two functions "keylist" and "keydetails" are now mere wrappers around
"parse_with_colons":
sub keylist
{
return parse_with_colons('--list-keys', 9, 4,1,6,9);
}
sub keydetails
{
my $key = shift;
$key = '0x' . $key if ($key !~ /^0x/);
return parse_with_colons("--list-keys $key", 9);
}
"parse_with_colons" likely can be used as gpg output parsing routine
in further functions, too, but so far I noticed only the two mentioned
above to be affected, so I changed only those.
(*) I initially uploaded a package build with -A as a proof that the
fix works. But I didn't notice before the upload that
gui-apt-key_0.4-2.2_all.changes doesn't include the source package
in the upload. Sorry for that noise.
Regards, Axel
--
,''`. | Axel Beckert <[email protected]>, http://people.debian.org/~abe/
: :' : | Debian Developer, ftp.ch.debian.org Admin
`. `' | 4096R: 2517 B724 C5F6 CA99 5329 6E61 2FF9 CD59 6126 16B5
`- | 1024D: F067 EA27 26B9 C3FC 1486 202E C09E 1D89 9593 0EDE
diff -u gui-apt-key-0.4/GAK/Backend.pm gui-apt-key-0.4/GAK/Backend.pm
--- gui-apt-key-0.4/GAK/Backend.pm
+++ gui-apt-key-0.4/GAK/Backend.pm
@@ -34,53 +34,72 @@
sub keylist
{
- my @return;
-
- my $cmd = qq{gpg --no-options --no-default-keyring
- --secret-keyring %s
- --trustdb-name %s
- --keyring %s
- --with-colons --list-keys
- 2> /dev/null};
- $cmd =~ s/\r?\n//g;
- $cmd = sprintf ($cmd, SECRING, TRUSTDB, join(' --keyring ', KEYRING));
-
- if (open (G, "$cmd|")) {
- while (<G>) {
- next unless (/^pub:/);
- chomp;
- my @a = split (/:/);
- push @return, [$a[4], $a[1], $a[6], $a[9]];
- }
- close (G);
- }
- return sort {$a->[3] cmp $b->[3]} @return;
+ return parse_with_colons('--list-keys', 9, 4,1,6,9);
}
sub keydetails
{
my $key = shift;
- my @return;
-
$key = '0x' . $key if ($key !~ /^0x/);
+
+ return parse_with_colons("--list-keys $key", 9);
+}
+
+sub parse_with_colons {
+ my $gpg_command_parameter = shift;
+ my $sort_column = shift;
+ my @columns = @_;
+
my $cmd = qq{gpg --no-options --no-default-keyring
--secret-keyring %s
--trustdb-name %s
--keyring %s
- --with-colons --list-key %s};
+ --with-colons %s
+ 2> /dev/null};
$cmd =~ s/\r?\n//g;
- $cmd = sprintf ($cmd, SECRING, TRUSTDB, join(' --keyring ', KEYRING),
$key);
+ $cmd = sprintf ($cmd, SECRING, TRUSTDB, join(' --keyring ', KEYRING),
+ $gpg_command_parameter);
+ my %keys = ();
+ my $current_key;
+ my $uid_seen = 0;
if (open (G, "$cmd|")) {
while (<G>) {
- next unless (/^pub:/);
chomp;
- my @a = split (/:/);
- push @return, [@a];
+ if (/^pub:/) {
+ my @a = split (/:/);
+ $current_key = $a[4];
+ $keys{$current_key} = \@a;
+ # Reset $uid_seen
+ $uid_seen = 0;
+ } elsif (!$uid_seen and /^uid:/) {
+ # GnuPG 2.x has separate uid lines.
+ $uid_seen = 1; # Only use first UID in case of multiple ones.
+ my @uid = split (/:/);
+ # Fill in UID from separate line in case of GnuPG 2.x output
+ $keys{$current_key}[9] ||= $uid[9];
+ }
}
close (G);
}
- return sort {$a->[9] cmp $b->[9]} @return;
+
+ # Sort keys by given column if requested
+ my @keys = keys %keys;
+ if (defined $sort_column) {
+ @keys = sort { $keys{$a}[$sort_column] cmp
+ $keys{$b}[$sort_column] } @keys;
+ }
+
+ my @return;
+ foreach my $key (@keys) {
+ # Either only return requested columns or all of them.
+ if (@columns) {
+ push @return, [ map { $keys{$key}[$_] } @columns ];
+ } else {
+ push @return, $keys{$key};
+ }
+ }
+ return @return;
}
sub fingerprint
diff -u gui-apt-key-0.4/debian/changelog gui-apt-key-0.4/debian/changelog
--- gui-apt-key-0.4/debian/changelog
+++ gui-apt-key-0.4/debian/changelog
@@ -1,3 +1,13 @@
+gui-apt-key (0.4-2.2) unstable; urgency=medium
+
+ * Non-maintainer upload
+ * Swap binary-* targets to fix FTBFS with "dpkg-buildpackage -A".
+ (closes: #831914)
+ * Fix empty owner with GnuPG 2.1 by also parsing "uid:" lines in
+ output and assigning them to the right key. (closes: #834465)
+
+ -- Axel Beckert <[email protected]> Sat, 27 Aug 2016 16:48:34 +0200
+
gui-apt-key (0.4-2.1) unstable; urgency=medium
* Non-maintainer upload with maintainer permission.
diff -u gui-apt-key-0.4/debian/rules gui-apt-key-0.4/debian/rules
--- gui-apt-key-0.4/debian/rules
+++ gui-apt-key-0.4/debian/rules
@@ -40,10 +40,10 @@
rm -rf debian/tmp
rm -f debian/{files,substvars}
-binary-indep:
+binary-arch:
# Nothing to be done here
-binary-arch: debclean
+binary-indep: debclean
test -f stamp-build || $(MAKE) -f debian/rules build
$(installbin) -d debian/tmp/DEBIAN
chown -R root.root debian/tmp
signature.asc
Description: Digital signature

