Control: tags -1 + patch

On Thu, 2014-10-23 at 20:00 +0100, Adam D. Barratt wrote:
> Control: retitle -1 dch should cope better with malformed trailers
> 
> On Thu, 2014-10-23 at 14:31 -0400, Joey Hess wrote:
> > If I run dch -r with the not quite correctly formatted changelog below,
> > it results in the entry below the UNRELEASED one getting deleted.
> > 
> > dch is getting confused by the lack of a full name before the email address.
> 
> fwiw, it's not just -r. I can reproduce the same issue by simply running
> dch.

The attached patch appears to work for me; testing appreciated.

Regards,

Adam
--- /usr/bin/debchange	2014-10-14 03:52:06.000000000 +0100
+++ ./debchange	2014-10-23 20:29:16.384017375 +0100
@@ -645,7 +645,8 @@
     fatal "No maintainer in changelog!"
 	unless exists $changelog->{Maintainer};
     $changelog->{Maintainer} = decode_utf8($changelog->{Maintainer});
-    ($MAINTAINER,$EMAIL) = ($changelog->{Maintainer} =~ /^([^<]+) <(.*)>/);
+    ($MAINTAINER,$EMAIL) = ($changelog->{Maintainer} =~ /^([^<]*) <(.*)>/);
+    $MAINTAINER ||= '';
     fatal "No distribution in changelog!"
 	unless exists $changelog->{Distribution};
     if ($vendor eq 'Ubuntu') {
@@ -1342,7 +1343,7 @@
 	    ($dist_indicator = $1) =~ s/[!:.,;]$//;
 	    chomp $dist_indicator;
 	}
-	elsif (/^ --\s+([^<]+)\s+/) {
+	elsif (/^ --\s+([^<]+)\s+/ || /^ --\s+<(.+?)>/) {
 	    $lastmaint=$1;
 	    # Remember where we are so we can skip back afterwards
 	    $savedline = $line;

Reply via email to