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

[lintian] 01/01: Detect overly-compressed xz packages. (Closes: #829100)



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

lamby pushed a commit to branch master
in repository lintian.

commit 1f8051cb211c53a66c6c526828eee3fa90847cc9
Author: Chris Lamb <lamby@debian.org>
Date:   Sat Jan 13 12:20:49 2018 +0530

    Detect overly-compressed xz packages. (Closes: #829100)
---
 checks/rules.desc                                      | 18 ++++++++++++++++++
 data/rules/rules-should-not-use                        |  2 +-
 debian/changelog                                       |  1 +
 .../debian/debian/rules                                | 10 ++++++++++
 t/tests/rules-xz-compression-level-too-high/desc       |  5 +++++
 t/tests/rules-xz-compression-level-too-high/tags       |  2 ++
 6 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/checks/rules.desc b/checks/rules.desc
index 9ca7af8..4e89148 100644
--- a/checks/rules.desc
+++ b/checks/rules.desc
@@ -319,3 +319,21 @@ Info: The <tt>debian/rules</tt> file for this package has an
  .
  Please add a call to <tt>dh_fixperms</tt>.
 Ref: #885909
+
+Tag: xz-compression-level-too-high
+Severity: normal
+Certainty: certain
+Info: The <tt>debian/rules</tt> file for this package has a call to
+ <tt>dh_builddeb(1)</tt> that specifies an overly eager xz(1) compression
+ level.
+ .
+ Whilst higher levels might reduce the size of big files, it has the side
+ effect of consuming a lot of memory during both compression and
+ extraction.
+ .
+ This can not only also waste time unnecessarily, it can cause packages to
+ FTBFS or even fail to install in resource-constrained environments or
+ architectures.
+ .
+ Please remove the call and let dpkg-deb(1) select suitable defaults.
+Ref: #829100, dpkg-deb(1)
diff --git a/data/rules/rules-should-not-use b/data/rules/rules-should-not-use
index e17bbed..47cab90 100644
--- a/data/rules/rules-should-not-use
+++ b/data/rules/rules-should-not-use
@@ -9,4 +9,4 @@ debian-rules-should-not-use-DH_EXTRA_ADDONS              ~~ ^\s*DH_EXTRA_ADDONS\
 debian-rules-should-not-use-or-modify-user-only-variable ~~ \bDEB_[^_ \t]+FLAGS_(?:SET|APPEND)\b
 debian-rules-should-not-use-pwd                          ~~ \$[\(\{]PWD[\)\}]
 debian-rules-should-not-use-underscore-variable          ~~ \$[\(\{]_[\)\}]
-
+xz-compression-level-too-high                            ~~ dh_builddeb\b.*--.*(?:-z\s*(?<info>9).*-Z\s*xz|-Z\s*xz.*-z\s*(?<info>9))
diff --git a/debian/changelog b/debian/changelog
index 1b46b54..58dd7da 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,7 @@ lintian (2.5.69) UNRELEASED; urgency=medium
   * data/rules/rules-should-not-use:
     + [CL] Include the assigned value in the Lintian output for the
       debian-rules-should-not-use-DH_EXTRA_ADDONS tag.
+    + [CL] Detect overly-compressed xz packages.  (Closes: #829100)
 
  -- Chris Lamb <lamby@debian.org>  Tue, 09 Jan 2018 20:55:21 +0530
 
diff --git a/t/tests/rules-xz-compression-level-too-high/debian/debian/rules b/t/tests/rules-xz-compression-level-too-high/debian/debian/rules
new file mode 100755
index 0000000..6034196
--- /dev/null
+++ b/t/tests/rules-xz-compression-level-too-high/debian/debian/rules
@@ -0,0 +1,10 @@
+#!/usr/bin/make -f
+
+%:
+	dh $@
+
+override_dh_builddeb:
+	dh_builddeb --  -Zxz  -z 9
+	dh_builddeb -- -z9 -Z xz
+	dh_builddeb -- -z8 -Z xz
+	dh_builddeb -- -z9 -Zgzip
diff --git a/t/tests/rules-xz-compression-level-too-high/desc b/t/tests/rules-xz-compression-level-too-high/desc
new file mode 100644
index 0000000..f234773
--- /dev/null
+++ b/t/tests/rules-xz-compression-level-too-high/desc
@@ -0,0 +1,5 @@
+Testname: rules-overeager-compression
+Version: 1.0
+Description: Test for over-eager tarball compression
+Test-For:
+ xz-compression-level-too-high
diff --git a/t/tests/rules-xz-compression-level-too-high/tags b/t/tests/rules-xz-compression-level-too-high/tags
new file mode 100644
index 0000000..c711ddf
--- /dev/null
+++ b/t/tests/rules-xz-compression-level-too-high/tags
@@ -0,0 +1,2 @@
+W: rules-overeager-compression source: xz-compression-level-too-high 9 (line 7)
+W: rules-overeager-compression source: xz-compression-level-too-high 9 (line 8)

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


Reply to: