[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.4-179-g7a7dc7a



The following commit has been merged in the master branch:
commit 7a7dc7acc388c2cd3948c7bc880a6329622b1937
Author: Niels Thykier <niels@thykier.net>
Date:   Tue Feb 21 09:02:57 2012 +0100

    Produce better error messages with invalid lab queries
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/debian/changelog b/debian/changelog
index 304d824..725b21d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -242,6 +242,9 @@ lintian (2.5.5) UNRELEASED; urgency=low
       release, pedantic tags were not affected by --display-level.
       A side-effect of this is that "pedantic" can no longer be
       used with "display-level" in the configuration file.
+    + [NT] Produce a better error message when asked to process an
+      URL or a path that is definitely not a valid lab query.
+      Thanks to Nicholas Bamber for the report.  (Closes: #651332)
   * frontend/lintian-info:
     + [NT] Support new lintian.log format.
     + [NT] Support new override file format with -a.
diff --git a/frontend/lintian b/frontend/lintian
index 348350d..cb666c5 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -1561,7 +1561,19 @@ sub handle_lab_query {
         ($type, $query) = ($1, $2);
     }
     # Split on /
-    ($pkg, $version, $arch) = split m,/,o, $query;
+    ($pkg, $version, $arch) = split m,/,o, $query, 3;
+    if ($pkg =~ m|^\.{0,2}$| or $pkg =~ m,_, or
+          (defined $arch and $arch =~ m,/,) ) {
+        # Technically, a string like "../somewhere/else",
+        # "somepkg_version_arch.deb", "/somewhere/somepkg.deb" or even
+        # "http://ftp.debian.org/pool/l/lintian/lintian_2.5.5_all.deb";
+        # could match the above.  Obviously, that is not a lab query.
+        # But the frontend sends it here, because the file denoted by
+        # that string does not exist.
+        warning ("\"$orig\" cannot be processed.");
+        warning ("It is not a valid lab query and it is not an existing file.");
+        exit 2;
+    }
 
     # if version (or/and arch) is omitted or is the special
     # value "_", let it be wildcard.
@@ -1588,8 +1600,11 @@ sub handle_lab_query {
         }
     } else {
         # specific type requested
-        my @pkgs = $LAB->get_package ($pkg, $type, $version, $arch);
-        push @res, @pkgs;
+        my @pkgs;
+        eval {
+            @pkgs = $LAB->get_package ($pkg, $type, $version, $arch);
+            push @res, @pkgs;
+        };
     }
 
     if (@res) {

-- 
Debian package checker


Reply to: