[lintian] 05/06: c/files.pm: Fix off-by-one in mtime comparison
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit 01a1b572456f6373dce8521d2fada23831f6f866
Author: Niels Thykier <niels@thykier.net>
Date: Mon Jan 18 20:11:07 2016 +0000
c/files.pm: Fix off-by-one in mtime comparison
Move the mtime part of the test into the "debs" suite, since the
"reproducible toolchain" fixes the mtime automatically (thus breaking
the test).
Signed-off-by: Niels Thykier <niels@thykier.net>
---
checks/files.pm | 2 +-
debian/changelog | 13 ++++++++-----
t/debs/files-mtime/Makefile | 22 ++++++++++++++++++++++
t/debs/files-mtime/desc | 5 +++++
t/debs/files-mtime/tags | 1 +
t/tests/files-gzip/debian/debian/rules | 6 ------
t/tests/files-gzip/desc | 1 -
t/tests/files-gzip/tags | 1 -
t/tests/files-gzip/upstream/timestamped-now.gz | Bin 23 -> 0 bytes
9 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/checks/files.pm b/checks/files.pm
index b28e1ad..5adebc2 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -1552,7 +1552,7 @@ sub run {
} else {
# see https://bugs.debian.org/762105
my $diff= $file->timestamp - $changelog_timestamp;
- if ($diff >= 0) {
+ if ($diff > 0) {
tag 'package-contains-timestamped-gzip',$file;
}
}
diff --git a/debian/changelog b/debian/changelog
index ddda61f..2d059be 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,11 @@ lintian (2.5.40) UNRELEASED; urgency=medium
XXX: generate tag summary
+ * checks/binaries.pm:
+ + [JW] Exclude /usr/lib/debug/.build-id/ from foreign-architecture
+ checks. Thanks to Aurelien Jarno for the bug report. (Closes:
+ #809262)
+ + [BR] Detect old style config script and detect Mutli-arch error.
* checks/changes-file.pm:
+ [JW] Use "~bpo7+N" as the suffix for wheezy-backports-sloppy
uploads. Thanks to Vincent Bernat for the bug report. (Closes:
@@ -10,11 +15,9 @@ lintian (2.5.40) UNRELEASED; urgency=medium
* checks/cruft.pm:
+ [BR] Pass information about minified javascript down to tag.
(Closes: #804147).
- * checks/binaries.pm:
- + [JW] Exclude /usr/lib/debug/.build-id/ from foreign-architecture
- checks. Thanks to Aurelien Jarno for the bug report. (Closes:
- #809262)
- + [BR] Detect old style config script and detect Mutli-arch error.
+ * checks/files.pm:
+ + [NT] Fix off-by-one in an "mtime" comparsion, which could give
+ false-positive package-contains-timestamped-gzip warnings.
* checks/source-copyright.{desc,pm}:
+ [JW] Apply patch from Mattia Rizzolo to update the machine-readable
copyright format specification URL. (Closes: #809248)
diff --git a/t/debs/files-mtime/Makefile b/t/debs/files-mtime/Makefile
new file mode 100644
index 0000000..76743e0
--- /dev/null
+++ b/t/debs/files-mtime/Makefile
@@ -0,0 +1,22 @@
+name = files-mtime
+
+all:
+
+ mkdir -p root/usr/share/doc/$(name) root/usr/share/$(name)
+ install -m0644 copyright changelog root/usr/share/doc/$(name)
+ gzip -9 root/usr/share/doc/$(name)/changelog
+ echo "Hallo World" | gzip -9c > root/usr/share/$(name)/foo.gz
+ # we set the mtime to "right" now. We use that as "now" to be
+ # more robust about being built in the past/present/future or
+ # in weird time-zones
+ # NB: foo.gz is bad, but changelog.gz is "ok" (ignoring the
+ # gzip header has a date).
+ NOW="$$(date -d "$$(dpkg-parsechangelog -lchangelog -SDate)" +%s)" ; \
+ touch -m -d @"$$((NOW+1))" root/usr/share/$(name)/foo.gz && \
+ touch -m -d @"$$((NOW))" root/usr/share/doc/$(name)/changelog.gz
+
+ create-deb --root root/ -o $(name).deb control
+
+clean:
+ rm -f *.tar.gz *.deb debian-binary md5sums
+ rm -rf root/
diff --git a/t/debs/files-mtime/desc b/t/debs/files-mtime/desc
new file mode 100644
index 0000000..6ee4968
--- /dev/null
+++ b/t/debs/files-mtime/desc
@@ -0,0 +1,5 @@
+Testname: files-mtime
+Sequence: 6000
+Version: 1.0
+Description: Test for mod time in the deb tarballs
+Test-For: package-contains-timestamped-gzip
diff --git a/t/debs/files-mtime/tags b/t/debs/files-mtime/tags
new file mode 100644
index 0000000..ef27255
--- /dev/null
+++ b/t/debs/files-mtime/tags
@@ -0,0 +1 @@
+W: files-mtime: package-contains-timestamped-gzip usr/share/files-mtime/foo.gz
diff --git a/t/tests/files-gzip/debian/debian/rules b/t/tests/files-gzip/debian/debian/rules
index 3c51877..c41cf65 100755
--- a/t/tests/files-gzip/debian/debian/rules
+++ b/t/tests/files-gzip/debian/debian/rules
@@ -7,12 +7,6 @@ override_dh_install:
dh_install
# we set the mtime to the past
touch -m -d "2003-06-21 12:12:12 UTC" debian/$(pkg)/etc/timestamped-past.gz
- # we set the mtime to "right" now (meaning two hours ahead of
- # the changelog file). We use that as "now" to be more robust
- # about being built in the past/present/future or in weird
- # time-zones
- NOW="$$(date -d "$$(dpkg-parsechangelog -SDate)" +%s)" ; \
- touch -m -d @"$$((NOW+3600*2))" debian/$(pkg)/etc/timestamped-now.gz
override_dh_installdocs:
dh_installdocs
diff --git a/t/tests/files-gzip/desc b/t/tests/files-gzip/desc
index 846d419..d3a4f83 100644
--- a/t/tests/files-gzip/desc
+++ b/t/tests/files-gzip/desc
@@ -6,4 +6,3 @@ Description: Test for issues handling gz but not gzip files
Test-Depends: dpkg (>= 1.17)
Test-for:
gz-file-not-gzip
- package-contains-timestamped-gzip
diff --git a/t/tests/files-gzip/tags b/t/tests/files-gzip/tags
index f474f2a..b64e671 100644
--- a/t/tests/files-gzip/tags
+++ b/t/tests/files-gzip/tags
@@ -1,3 +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
-W: files-gzip: package-contains-timestamped-gzip etc/timestamped-now.gz
diff --git a/t/tests/files-gzip/upstream/timestamped-now.gz b/t/tests/files-gzip/upstream/timestamped-now.gz
deleted file mode 100644
index 0f54535..0000000
Binary files a/t/tests/files-gzip/upstream/timestamped-now.gz and /dev/null differ
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: