Package: signing-party
Version: 1.1.5-1
Severity: normal
Tags: patch

Dear Maintainer,

gpgsigs currently doesn't wrap long UIDs in its LaTeX output.  This is
a problem, because after compilation and printing, the full UID is not
always visible on the printout.

I propose the enclosed patch, which crudely folds UIDs that are longer
than 78 characters.  (Wrapping on word boundaries only might be
preferable, but that's slightly harder to implement :-P, and the patch
matches a typical terminal behavior.)

Furthermore, longer digests such as SHA-256 might need to be folded as
well.  Since gpgparticipants(1) puts placeholders after the digest
algorithm, I propose to replace each placeholder character ‘_’ by the
corresponding hex character from the digest.  This allows gpgsigs'
output to follow closely the template given, hence in practice folding
long digests as well.

Thanks,
cheers,
-- 
Guilhem.


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (800, 'testing'), (700, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.12-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages signing-party depends on:
ii  gnupg                      1.4.16-1
ii  libc6                      2.17-97
ii  libclass-methodmaker-perl  2.19-1
ii  libgnupg-interface-perl    0.46-3
ii  libmailtools-perl          2.12-1
ii  libmime-tools-perl         5.505-1
ii  libterm-readkey-perl       2.31-1
ii  libtext-template-perl      1.46-1
ii  perl                       5.18.2-2
ii  qprint                     1.0.dfsg.2-2

Versions of packages signing-party recommends:
ii  dialog                          1.2-20130928-1
ii  libgd-gd2-perl                  1:2.46-3.1+b1
ii  libintl-perl                    1.23-1
ii  libpaper-utils                  1.1.24+nmu2
ii  libtext-iconv-perl              1.7-5+b1
ii  postfix [mail-transport-agent]  2.10.2-1
ii  recode                          3.6-21
ii  whiptail                        0.52.15-3

Versions of packages signing-party suggests:
ii  imagemagick                8:6.7.7.10-7
ii  mutt                       1.5.21-6.4
ii  texlive-latex-recommended  2013.20140123-1
ii  wipe                       0.22-1

-- no debconf information
diff -ru a/gpgsigs/gpgsigs b/gpgsigs/gpgsigs
--- a/gpgsigs/gpgsigs
+++ b/gpgsigs/gpgsigs
@@ -317,17 +317,31 @@
 while (<TXT>) {
 	$line++;
 	$_ = myrecode($_, $fromcharset, $charset);
-	if (/^MD5 Checksum:/ && defined $MD5) {
-		s/[_[:xdigit:]][_ [:xdigit:]]+_/$MD5/;
-	}
-	if (/^SHA1 Checksum:/ && defined $SHA1) {
-		s/[_[:xdigit:]][_ [:xdigit:]]+_/$SHA1/;
-	}
-	if (/^SHA256 Checksum:/ && defined $SHA256) {
-		s/[_[:xdigit:]][_ [:xdigit:]]+_/$SHA256/;
-	}
-	if (/^RIPEMD160 Checksum:/ && defined $RIPEMD160) {
-		s/[_[:xdigit:]][_ [:xdigit:]]+_/$RIPEMD160/;
+	my $md;
+	if (/^(?<md>\S+) Checksum:/) {
+		if ($+{md} eq 'MD5') {
+			$md = $MD5;
+		} elsif ($+{md} eq 'SHA1') {
+			$md = $SHA1;
+		} elsif ($+{md} eq 'SHA256') {
+			$md = $SHA256;
+		} elsif ($+{md} eq 'RIPEMD160') {
+			$md = $RIPEMD160;
+		}
+		if (!defined $md) {
+			warn "Unknown digest $+{md}";
+		} else {
+			$md =~ s/\s//g;
+			my $r = $_;
+			while ( /^(?:.*_)?$/ ) {
+				$line++;
+				$_ = <TXT>;
+				$r .= $_;
+			}
+            $r =~ s/_/%c/g;
+			print WRITE sprintf ($r, unpack ("C*", $md));
+			next;
+		}
 	}
 
 	if ( m/^[0-9]+\s+\[ \] Fingerprint OK/ ){
@@ -365,7 +379,15 @@
 		print WRITE "[$inc] incoming signatures\n" if $inc =~ /\S/;
 		if ($refresh or $latex) {
 			foreach $uid (@{$uids{$key}}) {
-				print WRITE print_tag($key, $uid) . " $uid\n";
+				my $tag = print_tag($key, $uid);
+				if (!$latex) {
+					print WRITE $tag .' '. $uid,"\n";
+				} else {
+					for (my $i = 0; $i < length $uid; $i+=78) {
+						print WRITE ($i ? ' ' x length $tag : $tag ), ' ',
+									substr ($uid, $i, 78), "\n";
+					}
+				}
 				if ($latex and ($uid =~ /^\[jpeg image/)) {
 					$photocount++;
 					print WRITE "\\begin{flushright}\n";

Attachment: signature.asc
Description: Digital signature

Reply via email to