[dpkg] 23/200: Dpkg::Changelog::Entry::Debian: Fix parse error message when date is on May

Ximin Luo infinity0 at debian.org
Wed Apr 5 15:17:09 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository dpkg.

commit e20aeeaf590385d86cfb4754fbdc2e9ef85950b9
Author: Nishanth Aravamudan <nish.aravamudan at canonical.com>
Date:   Fri Nov 11 00:56:44 2016 +0100

    Dpkg::Changelog::Entry::Debian: Fix parse error message when date is on May
    
    When a broken date is on May the error message ended up being very
    confusing as it mentioned that it was using a full instead of an
    abbreviated month name, because for May both are the same.
    
    Nest the conditionals to avoid this problem.
    
    Closes: #843829
    Signed-off-by: Guillem Jover <guillem at debian.org>
---
 debian/changelog                       |  4 ++++
 scripts/Dpkg/Changelog/Entry/Debian.pm | 14 +++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 5052b32..f820d42 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,10 @@ dpkg (1.18.14) UNRELEASED; urgency=medium
     some cases segfaults when reporting the error summary at the end.
     Regression introduced in dpkg 1.18.11. Closes: #843874
   * Change default color behavior to auto.
+  * Perl modules:
+    - Fix confusing date parse error message in Dpkg::Changelog::Entry::Debian
+      when the date contains “May”. Closes: #843829
+      Thanks to Nishanth Aravamudan <nish.aravamudan at canonical.com>.
   * Test suite:
     - Do not fail tests on missing fakeroot, just skip them.
   * Build system:
diff --git a/scripts/Dpkg/Changelog/Entry/Debian.pm b/scripts/Dpkg/Changelog/Entry/Debian.pm
index 829eace..3d18886 100644
--- a/scripts/Dpkg/Changelog/Entry/Debian.pm
+++ b/scripts/Dpkg/Changelog/Entry/Debian.pm
@@ -226,11 +226,15 @@ 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}) {
+	        # We have to nest the conditionals because May is the same in
+	        # full and abbreviated forms!
+	        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);
 	};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list