[SCM] Debian package checker branch, master, updated. 2.5.4-167-gc137aef
The following commit has been merged in the master branch:
commit c137aef83f94db3e4e66ed5bde453b247e9ef9ca
Author: Niels Thykier <niels@thykier.net>
Date: Tue Feb 14 21:05:59 2012 +0100
Util.pm: Report line number in syntax errors of dctrl files
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/debian/changelog b/debian/changelog
index 1cfac2e..9c4dd1d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -285,6 +285,9 @@ lintian (2.5.5) UNRELEASED; urgency=low
+ [NT] Create clean_env function to handle cleaning of the
environment for children processes and finding a suitable UTF-8
locale (when needed).
+ + [NT] Report line number instead of "0-indexed" paragraph number
+ in syntax errors. Thanks to Jari Aalto for the suggestion.
+ (Closes: #659909)
* man/lintian.pod.in:
+ [NT] Removed the notes that some options disable loading of a
diff --git a/lib/Util.pm b/lib/Util.pm
index af4d3cf..18a768e 100644
--- a/lib/Util.pm
+++ b/lib/Util.pm
@@ -81,7 +81,6 @@ sub parse_dpkg_control {
sub _parse_dpkg_control_iterative {
my ($code, $CONTROL, $debconf_flag) = @_;
- my $cur_section = 0;
my $section = {};
my $open_section = 0;
my $last_tag;
@@ -100,7 +99,6 @@ sub _parse_dpkg_control_iterative {
# pass the current section to the handler
$code->($section);
$section = {};
- $cur_section++;
$open_section = 0;
}
}
@@ -138,8 +136,8 @@ sub _parse_dpkg_control_iterative {
$last_tag = $tag;
}
# continued field?
- elsif (m/^([ \t].*)$/o) {
- $open_section or fail("syntax error in paragraph $cur_section after the field $last_tag: $_");
+ elsif (m/^([ \t].*\S.*)$/o) {
+ $open_section or die "syntax error at line $.: Continuation line outside a paragraph.\n";
# Policy: Many fields' values may span several lines; in this case
# each continuation line must start with a space or a tab. Any
@@ -151,9 +149,15 @@ sub _parse_dpkg_control_iterative {
}
# None of the above => syntax error
else {
- my $message = "syntax error in paragraph $cur_section";
- $message.= " after the field $last_tag: $_" if defined $last_tag;
- fail($message);
+ my $message = "syntax error at line $.";
+ if (m/^\s+$/) {
+ $message .= ": Whitespace line not allowed (possibly missing a \".\").\n";
+ } else {
+ # Replace non-printables and non-space characters with "_"... just in case.
+ s/[^[:graph:][:space:]]/_/go;
+ $message .= ": Cannot parse line \"$_\"\n";
+ }
+ die $message;
}
}
# pass the last section (if not already done).
diff --git a/t/source/control-file-syntax-error/tags b/t/source/control-file-syntax-error/tags
index 8445525..465fe29 100644
--- a/t/source/control-file-syntax-error/tags
+++ b/t/source/control-file-syntax-error/tags
@@ -1 +1 @@
-E: control-file-syntax-error source: syntax-error-in-control-file debian/control: paragraph 1 after the field depends: Recommends a-colon, after-the-field, name
+E: control-file-syntax-error source: syntax-error-in-control-file debian/control: syntax error at line 11: Cannot parse line "Recommends a-colon, after-the-field, name"
diff --git a/t/tests/debconf-syntax-error/tags b/t/tests/debconf-syntax-error/tags
index 630e7a1..734f16e 100644
--- a/t/tests/debconf-syntax-error/tags
+++ b/t/tests/debconf-syntax-error/tags
@@ -1,2 +1,2 @@
-E: debconf-syntax-error source: syntax-error-in-debconf-template templates: paragraph 0 after the field type: Description whoops, I forgot a colon
-E: debconf-syntax-error: syntax-error-in-debconf-template templates: paragraph 0 after the field type: Description whoops, I forgot a colon
+E: debconf-syntax-error source: syntax-error-in-debconf-template templates: syntax error at line 3: Cannot parse line "Description whoops, I forgot a colon"
+E: debconf-syntax-error: syntax-error-in-debconf-template templates: syntax error at line 3: Cannot parse line "Description whoops, I forgot a colon"
diff --git a/t/tests/source-copyright-dep5-syntax-error/tags b/t/tests/source-copyright-dep5-syntax-error/tags
index 13f2420..cbcc70f 100644
--- a/t/tests/source-copyright-dep5-syntax-error/tags
+++ b/t/tests/source-copyright-dep5-syntax-error/tags
@@ -1 +1 @@
-W: source-copyright-dep5-syntax-error source: syntax-error-in-dep5-copyright paragraph 2 after the field license: This package is distributed in the hope that it will be useful, but WITHOUT
+W: source-copyright-dep5-syntax-error source: syntax-error-in-dep5-copyright syntax error at line 13: Continuation line outside a paragraph.
--
Debian package checker
Reply to: