From d5571c62a48a210e691a7864a70b9c2bf3890336 Mon Sep 17 00:00:00 2001 From: weasel Date: Wed, 6 Jul 2005 11:57:30 +0000 Subject: [PATCH] Whine about malformed input git-svn-id: svn://svn.debian.org/pgp-tools/trunk@120 b513b33f-fedd-0310-b452-c3deb5f4c849 --- gpgsigs/gpgsigs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gpgsigs/gpgsigs b/gpgsigs/gpgsigs index 483e4c5..35d6d71 100755 --- a/gpgsigs/gpgsigs +++ b/gpgsigs/gpgsigs @@ -261,10 +261,14 @@ sub print_tag return $r; } +$key = undef; +$uid = undef; +my $line = 0; print STDERR "Annotating $keytxt, writing into $outfile\n"; open (TXT, $keytxt) or die ("Cannot open $keytxt\n"); open (WRITE, '>'.$outfile) or die ("Cannot open $outfile for writing\n"); while () { + $line++; $_ = myfromrecode($_); if (/^MD5 Checksum:/ && defined $MD5) { s/[_[:xdigit:]][_ [:xdigit:]]+_/$MD5/; @@ -282,7 +286,10 @@ while () { } if ( m/^uid +(.*)$/ ) { $uid = $1; - die "key is undefined" unless defined $key; + unless (defined $key) { + warn "key is undefined - input text is possibly malformed near line $line\n"; + next; + }; die "uid is undefined, key $key" unless defined $uid; die "bad tag from $key | $uid" unless defined (print_tag($key, $uid)); print WRITE print_tag($key, $uid) . " $_"; -- 2.39.5