Bug#233116: lintian: check that templates are separated by an empty line
Package: lintian
Version: 1.22.10
Severity: wishlist
Tags: patch
Hi,
if the templates file contains templates which are not separated by an
empty line (e.g because this line has a spurious space, or because it
is missing), read_dpkg_control() will return garbage and further checks
will display error messages which are not related to the problem.
Moreover debconf will refuse to load this broken file.
Denis
Index: debconf
===================================================================
--- debconf (revision 43)
+++ debconf (working copy)
@@ -61,6 +61,18 @@
print "E: $pkg $type: debconf-config-not-executable\n";
}
+# First check that templates are separated by an empty line
+if ($seentemplates) {
+ open(TMPL, "control/templates") or fail("Can't open control/templates: $!");
+ local $/ = undef;
+ $_ = <TMPL>;
+ close TMPL;
+ if (m/[^\n]\nTemplate:/i) {
+ print "E: $pkg $type: no-empty-line-before-template\n";
+ $seentemplates = '';
+ }
+}
+
# Lots of template checks.
my @templates = $seentemplates ? read_dpkg_control("control/templates") : ();
Index: debconf.desc
===================================================================
--- debconf.desc (revision 43)
+++ debconf.desc (working copy)
@@ -26,6 +26,13 @@
package if debconf is not present; please contact &maint; so that this
exception would be recognized in future versions of Lintian.
+Tag: no-empty-line-before-template
+Type: error
+Info: The templates file contains at least two templates which are not
+ separated by an empty line. It is invalid and cannot be processed by
+ debconf. Further syntax checks cannot be performed on this file and
+ are skipped.
+
Tag: unknown-field-in-templates
Type: error
Info: See the Debconf Programmer's Tutorial for a list of the possible
Reply to: