[libconfig-model-dpkg-perl] 05/07: scanner: provide better error message for invalid (c) year ranges

dod at debian.org dod at debian.org
Fri May 8 17:04:14 UTC 2015


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

dod pushed a commit to branch master
in repository libconfig-model-dpkg-perl.

commit 1fd04a507bc02b8ed4def57b93416317e37fc945
Author: Dominique Dumont <dod at debian.org>
Date:   Fri May 8 18:45:00 2015 +0200

    scanner: provide better error message for invalid (c) year ranges
---
 lib/Dpkg/Copyright/Scanner.pm | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/Dpkg/Copyright/Scanner.pm b/lib/Dpkg/Copyright/Scanner.pm
index 1685e80..b7cfe29 100644
--- a/lib/Dpkg/Copyright/Scanner.pm
+++ b/lib/Dpkg/Copyright/Scanner.pm
@@ -199,7 +199,10 @@ sub __pack_copyright ($r) {
             eval {
                 $span->set_range_as_string($year, $owner);
             };
-            return $r if $@; # invalid range
+            if ($@) {
+                say "Invalid year range in copyright: $r";
+                return $r;
+            }
         }
         $span->consolidate();
         push @res, $span->get_range_list. ', '. $owner;
@@ -313,7 +316,13 @@ sub __coalesce_copyright_years($entries, $owners) {
             return () if $years[$i] =~ /[^\d,\s-]/;
             my $span = $ranges_of_years[$i] //= Array::IntSpan->new();
             return () unless $span; # bail out in case of problems
-            $span->set_range_as_string($years[$i], 1);
+            eval {
+                $span->set_range_as_string($years[$i], 1);
+            };
+            if ($@) {
+                say "Invalid year range: ",$years[$i];
+                return ();
+            }
         }
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git



More information about the Pkg-perl-cvs-commits mailing list