From ca50d8718c5e3f0cd334541c24d966a69e64c86e Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Tue, 14 Jul 2015 17:18:16 +0200
Subject: [PATCH] Parse::DebianChangelog: Remove support for broken timezone
 names
Status: sent
Debbug: 792414
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The Debian changelog trailer regex intended to support a timezone name
inside parenthesis, like this:

 -- Name <mail@example.org>  Sat, 30 May 2015 03:18:43 +0200 (CEST)

is bogus, and it only accepts one character. As in:

 -- Name <mail@example.org>  Sat, 30 May 2015 03:18:43 +0200 (C)

which while also “valid”, as per RFC822, they are pretty much useless
as per RFC5322. It seems the regex was “inherited” from the dpkg
implementation which has kept that part unchanged since its inception
in dpkg 1.3.0, 1996-08.

So let's just drop it instead of fixing the regex, given that the
timezone name has never been accepted, many time-parsing functions
ignore it, it is redundant, declared obsolete by RFC5322 and Debian
policy dropped an explicit reference to it due to bug 569174.

Signed-off-by: Guillem Jover <guillem@debian.org>
---
 lib/Parse/DebianChangelog.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Parse/DebianChangelog.pm b/lib/Parse/DebianChangelog.pm
index dbb1531..fe31735 100644
--- a/lib/Parse/DebianChangelog.pm
+++ b/lib/Parse/DebianChangelog.pm
@@ -390,7 +390,7 @@ sub parse {
 	} elsif (m/^\S/) {
 	    $self->_do_parse_error($file, $.,
 				  __g( "badly formatted heading line" ), "$_");
-	} elsif (m/^ \-\- (?<name>.*) <(?<email>.*)>(?<sep>  ?)(?<date>(?:\w+\,\s*)?\d{1,2}\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}(\s+\([^\\\(\)]\))?)$/o) {
+	} elsif (m/^ \-\- (?<name>.*) <(?<email>.*)>(?<sep>  ?)(?<date>(?:\w+\,\s*)?\d{1,2}\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4})$/o) {
 	    $expect eq 'more change data or trailer' ||
 		$self->_do_parse_error($file, $.,
 				       __g( "found trailer where expected %s",
-- 
2.4.3.573.g4eafbef

