tags 516706 patch
thanks
-=| gregor herrmann, Tue, May 26, 2009 at 07:11:38PM +0200 |=-
> If someone finds the time to write such a test it should probably
> include all fields that can have comma separated lists.
Here's a patch implementing this. Being bitten by the missing coomma
problem was stimulating :)
The new check detects cases like
Depends: foo, bar
baz
and gives false positives for
Depends: foo, bar, baz
(>= 2)
and
Depends: foo, bar, baz (>=
2)
Given that the later two cases are not very likely to happen with
people that carry about easy reading of lists as to wrap them, I think
the check is good enough.
Thanks for considering,
--
dam
diff --git a/checks/control-file b/checks/control-file
index fb62cdd..56cbf48 100644
--- a/checks/control-file
+++ b/checks/control-file
@@ -105,6 +105,33 @@ for my $binary_control (@binary_controls) {
}
}
+# Check if comma-separated values that span on multiple lines don't ommit
+# commas as in the following case:
+# Depends: foo, bar
+# baz
+for my $control ( $header, @binary_controls ) {
+ for my $field ( qw(Build-Depends Build-Conflicts Build-Depends-Indep
+ Build-Conflicts-Indep Pre-Depends Depends Recommends Suggests
+ Breaks Conflicts Provides Replaces Enhances) ) {
+ next unless $control->{lc($field)};
+ if ( $control->{lc($field)} =~ /
+ ([^,]+) # previous entry
+ \s*\n\s+ # new line + space
+ ([^,]+) # next entry
+ /x ) {
+ my $stanza = ( $control->{source}
+ ? 'source stanza'
+ : 'Package: ' . $control->{package}
+ );
+ my ( $prev, $next ) = ( $1, $2 );
+ for ( $prev, $next ) {
+ s/^\s+//; s/\s+$//;
+ }
+ tag 'missing-comma-between-items', "in $field field between '$prev' and '$next', $stanza" ;
+ }
+ }
+}
+
# Make sure that a stronger dependency field doesn't imply any of the elements
# of a weaker dependency field. dpkg-gencontrol will fix this up for us, but
# we want to check the source package since dpkg-gencontrol may silently "fix"
diff --git a/checks/control-file.desc b/checks/control-file.desc
index efd4144..cf917d2 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -142,6 +142,14 @@ Info: The given field in the <tt>debian/control</tt> file has a substvar
the control file will have a syntax error. You probably meant to put a
comma after the substvar expansion.
+Tag: missing-comma-between-items
+Severity: important
+Certainty: possible
+Info: The given field in the <tt>debian/control</tt> file contains a list
+ of items separated by commas. It seems that when wrapping the list on
+ multiple lines, a comma is missing at the end of some line. This can lead
+ to bogus or incomplete dependencies, conflicts etc.
+
Tag: package-depends-on-hardcoded-libc
Severity: normal
Certainty: certain
Attachment:
signature.asc
Description: Digital signature