Package: dpkg
Version: 1.18.10ubuntu1
Severity: important
Tags: patch

Dear Maintainer,

Running dpkg-parsechangelog on changelogs that produce date parsing
problems, e.g.:

Tue, 17 May 2008 10:93:55 -0500

(don't ask me how it got there, but it happened in one Ubuntu publish).

ends up with an error like, "uses full instead of abbreviated month name
'May'", which is obviously not the actual problem. I think there is
actually a bug in dpkg (introduced in:
https://anonscm.debian.org/cgit/dpkg/dpkg.git/commit/scripts/Dpkg/Changelog/Entry/Debian.pm?id=21f5898d846a1cd69bdc6849e2097168cde02fdf),
in that if a full month is found to be used, it's not checked that the
full month is *also* an abbreviated month (only true for May, though).

I tested a fix with below patch on my local system. It feels like it
might be cleaner to special-case May as the only affected month, but I
think the logic was simply incorrect before either way -- it only makes
sense to check if a full month was used if an abbreviated month wasn't.

Thanks,
Nish

--- /usr/share/perl5/Dpkg/Changelog/Entry/Debian.pm.bak 2016-11-02 
17:07:08.195115132 -0700
+++ /usr/share/perl5/Dpkg/Changelog/Entry/Debian.pm     2016-11-02 
17:08:14.020173675 -0700
@@ -226,11 +226,13 @@ sub parse_trailer {
            # Validate the month. Date::Parse used to accept both abbreviated
            # and full months, but Time::Piece strptime() implementation only
            # matches the abbreviated one with %b, which is what we want anyway.
-           if (exists $month_name{$8}) {
-               push @errors, sprintf(g_('uses full instead of abbreviated 
month name \'%s\''),
-                                     $8, $month_name{$8});
-           } elsif (not exists $month_abbrev{$8}) {
-               push @errors, sprintf(g_('invalid abbreviated month name 
\'%s\''), $8);
+           if (not exists $month_abbrev{$8}) {
+                if (exists $month_name{$8}) {
+                   push @errors, sprintf(g_('uses full instead of abbreviated 
month name \'%s\''),
+                                         $8, $month_name{$8});
+                } else {
+                   push @errors, sprintf(g_('invalid abbreviated month name 
\'%s\''), $8);
+                }
            }
            push @errors, sprintf(g_("cannot parse non-comformant date '%s'"), 
$7);
        };


-- 
Nishanth Aravamudan
Ubuntu Server
Canonical Ltd

Reply via email to