Bug#925200: missing warning for wrong path
control: retitle -1 check doc-base-file-references-wrong-path
control: tags -1 + patch
Excuse me, lintian warning was correct.
But after checking this bug of mine, I came up with a possible
improvement for the lintian check. I made a proof-of-concept patch
here.
Package: lintian
Version: 2.11.0
Severity: normal
Requested action for /usr/share/lintian/checks/menus.pm:
========================================================
* add sanity check for the file path to be usr/share/doc/*
or /usr/share/info/*.
--> /usr/share/lintian/checks/menus.pm before line 353
add file path matching rule and produce error message as
needed.
Attached a proof of concept patch:
Note:
I didn't run perltidy since that changed many other parts.
I still didn't figure out how the test suite within lintian works.
This code is tested by installing it to the target pat manually ;-)
Osamu
PS: I at least see that libreoffice-help-en-us should fail this new
test. It shouldn't list /usr/share/libreoffice/help/media/* which is
outside of /usr/share/doc/*. Instead, it should create symlink using
dh_link:
/usr/share/doc/<package>/help -> /usr/share/libreoffice/help
Then use this new path for doc-base.
PS sixerjman: I think your concern is addressed with lintian now.
>From 30479d72937d84fbd501f2f61d40cb1169cb35bd Mon Sep 17 00:00:00 2001
From: Osamu Aoki <osamu@debian.org>
Date: Thu, 21 Mar 2019 20:43:22 +0900
Subject: [PATCH 1/1] Add check for doc-base-file-references-wrong-path
This test make sure that the files referenced in an Index or Files field
always uses correct path as requested by doc-base 2.3.2.2.
Signed-off-by: Osamu Aoki <osamu@debian.org>
---
checks/menus.desc | 8 ++++++++
checks/menus.pm | 5 +++++
2 files changed, 13 insertions(+)
diff --git a/checks/menus.desc b/checks/menus.desc
index af26ee9..06c1e8a 100644
--- a/checks/menus.desc
+++ b/checks/menus.desc
@@ -144,6 +144,14 @@ Info: The Index field in a doc-base file should reference the single index
should be listed in the Files field.
Ref: doc-base 2.3.2.2
+Tag: doc-base-file-references-wrong-path
+Severity: important
+Certainty: certain
+Info: One of the files referenced in an Index or Files field in this
+ doc-base control file lists a wrong file path which doesn't start with
+ /usr/share/doc/ nor with /usr/share/info/.
+Ref: doc-base 2.3.2.2
+
Tag: doc-base-file-references-missing-file
Severity: important
Certainty: certain
diff --git a/checks/menus.pm b/checks/menus.pm
index f66d825..521ab5d 100644
--- a/checks/menus.pm
+++ b/checks/menus.pm
@@ -350,6 +350,11 @@ sub check_doc_base_field {
if ($field eq 'index' && @files > 1) {
tag 'doc-base-index-references-multiple-files', "$dbfile:$line";
}
+ for my $file (@files) {
+ next if $file =~ m %^/usr/share/doc/%;
+ next if $file =~ m %^/usr/share/info/%;
+ tag 'doc-base-file-references-wrong-path', "$dbfile:$line", $file;
+ }
for my $file (@files) {
next if $file eq '';
my $realfile = delink($file, $all_links);
--
2.20.1
Reply to: