[PATCH] Make matches on compression (i.e. gzip, bzip2, etc...) extensions less permissive.

David Bremner bremner at unb.ca
Fri Apr 2 16:13:22 UTC 2010


---
 lib/Sbuild/Build.pm |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 5741f84..f94ae4f 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -48,6 +48,9 @@ use Sbuild::Utility qw(check_url download parse_file);
 use Sbuild::AptitudeBuildDepSatisfier;
 use Sbuild::InternalBuildDepSatisfier;
 
+# Legal extensions for compressed tarballs
+our $compress_ext='(?:gz|bz2|lzma|xz)';
+
 BEGIN {
     use Exporter ();
     our (@ISA, @EXPORT);
@@ -650,7 +653,7 @@ sub fetch_source_files {
 
     $dsctext =~ /^Files:\s*\n((\s+.*\s*\n)+)/mi and $files = $1;
     @other_files = map { (split( /\s+/, $_ ))[3] } split( "\n", $files );
-    $files =~ /(\Q$pkg\E\.(?:orig\.)?tar\.[a-z\d]+)$/mi and $orig = $1;
+    $files =~ /(\Q$pkg\E\.(?:orig\.|)tar\.${compress_ext})$/mi;
 
     $self->log_subsubsection("Check arch");
     if (!$dscarchs) {
@@ -1784,14 +1787,14 @@ sub fixup_pkgv {
             dsc| # a dsc
             deb| # or deb
             diff\.gz| # or diff.gz
-            debian\.tar\.[a-z\d]+| # or debian.tar.$extension
+            debian\.tar\.${compress_ext}| # or debian.tar.$extension
             ( # or some tarball
                 orig # orig
                 (-[\w-]+)? # followed by component part 0 or 1 time
                 \. # followed by a dot
             )? # matches 0 time for native, 1 time for upstream
             tar # tar portion
-            \.[a-z\d]+ # matches any extension like gz, bz2, etc.
+            \.${compress_ext}+ # matches any extension like gz, bz2, etc.
         )$ # must be at the end of the line
         }{}x; # strip extension
     $pkgv =~ s/_[a-zA-Z\d+~-]+\.(changes|deb)$//; # strip extension
-- 
1.7.0


--=-=-=--





More information about the Buildd-tools-devel mailing list