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

[SCM] Debian package checker branch, master, updated. 2.2.6-78-g6f56cdb



The following commit has been merged in the master branch:
commit 17ada737e7fbd96748714c720f0d4ecb42a6049e
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Sun Mar 8 18:34:50 2009 -0600

    Handle *.gz files that aren't gzip files
    
    Avoid false positives, correctly handle, and warn about .gz files that are
    not really gzip files.

diff --git a/checks/changelog-file b/checks/changelog-file
index f02895a..a658fb9 100644
--- a/checks/changelog-file
+++ b/checks/changelog-file
@@ -118,7 +118,7 @@ foreach (sort keys %{$info->index}) {
 		}
 	    }
 	    if (not $max_compressed) {
-		unless ($is_a_symlink{$file1}) {
+		unless ($is_a_symlink{$file1} or $file_info{$file1} !~ m/gzip compressed/) {
 		    tag "changelog-not-compressed-with-max-compression", "$file";
 		}
 	    }
diff --git a/checks/files b/checks/files
index 4add991..59295d7 100644
--- a/checks/files
+++ b/checks/files
@@ -294,7 +294,9 @@ foreach my $file (sort keys %{$info->index}) {
 		}
 		# gzipped zero byte files:
 		# 276 is 255 bytes (maximal length for a filename) + gzip overhead
-		if ($file =~ m,.gz$, and $index_info->{size} <= 276 and $index_info->{type} =~ m,^[-h],) {
+		if ($file =~ m,.gz$, and $index_info->{size} <= 276
+		    and $index_info->{type} =~ m,^[-h],
+		    and $info->file_info->{$file} =~ m/gzip compressed/) {
 		    unless (`gzip -dc unpacked/$file`) {
 			tag "zero-byte-file-in-doc-directory", "$file";
 		    }
@@ -547,6 +549,11 @@ foreach my $file (sort keys %{$info->index}) {
 	tag "bad-permissions-for-ali-file", "$file";
     }
 
+    # ---------------- .gz files
+    if ($file =~ m/\.gz/ && $info->file_info->{$file} !~ m/gzip compressed/) {
+	tag "gz-file-not-gzip", "$file";
+    }
+
     # ---------------- any files
     if ($index_info->{type} !~ m/^d/) {
 	unless ($type eq 'udeb'
diff --git a/checks/files.desc b/checks/files.desc
index 522cce0..6c3390f 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -966,3 +966,10 @@ Certainty: certain
 Info: The icon has a size that differs from the size specified by the name
  of the directory under which it was installed.  The icon was probably
  mistakenly installed into the wrong directory.
+
+Tag: gz-file-not-gzip
+Severity: normal
+Certainty: possible
+Info: The given file ends with .gz which suggests it is compressed with gzip
+ but it doesn't appear to actually be one.  gzip will fail with an error on
+ such cases and should therefor be avoided or fixed, as necessary.
diff --git a/t/tests/files-gzip/debian/debian/install b/t/tests/files-gzip/debian/debian/install
new file mode 100644
index 0000000..2ba1ce3
--- /dev/null
+++ b/t/tests/files-gzip/debian/debian/install
@@ -0,0 +1 @@
+*.gz etc/
diff --git a/t/tests/files-gzip/debian/debian/rules b/t/tests/files-gzip/debian/debian/rules
new file mode 100755
index 0000000..ece1c4a
--- /dev/null
+++ b/t/tests/files-gzip/debian/debian/rules
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+pkg=files-gzip
+%:
+	dh $@
+binary:
+	dh --until install binary
+	echo "Hello world :)" > debian/$(pkg)/usr/share/doc/$(pkg)/changelog.gz
+	dh --after install binary
diff --git a/t/tests/files-gzip/desc b/t/tests/files-gzip/desc
new file mode 100644
index 0000000..227f6da
--- /dev/null
+++ b/t/tests/files-gzip/desc
@@ -0,0 +1,6 @@
+Testname: files-gzip
+Sequence: 6000
+Version: 1.0-1
+Type: non-native
+Description: Test for issues handling gz but not gzip files
+Test-for: gz-file-not-gzip
diff --git a/t/tests/files-gzip/tags b/t/tests/files-gzip/tags
new file mode 100644
index 0000000..b64e671
--- /dev/null
+++ b/t/tests/files-gzip/tags
@@ -0,0 +1,2 @@
+W: files-gzip: gz-file-not-gzip etc/bad.gz
+W: files-gzip: gz-file-not-gzip usr/share/doc/files-gzip/changelog.gz
diff --git a/t/tests/files-gzip/upstream/bad.gz b/t/tests/files-gzip/upstream/bad.gz
new file mode 100644
index 0000000..45b983b
--- /dev/null
+++ b/t/tests/files-gzip/upstream/bad.gz
@@ -0,0 +1 @@
+hi
diff --git a/t/tests/files-gzip/upstream/good.gz b/t/tests/files-gzip/upstream/good.gz
new file mode 100644
index 0000000..0f54535
Binary files /dev/null and b/t/tests/files-gzip/upstream/good.gz differ

-- 
Debian package checker


Reply to: