[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#516706: lintian: commas in several fields



-=| Adam D. Barratt, Wed, May 27, 2009 at 08:34:54AM +0100 |=-
> On Wed, 2009-05-27 at 09:50 +0300, Damyan Ivanov wrote:
> > -=| Damyan Ivanov, Wed, May 27, 2009 at 12:02:31AM +0300 |=-
> > > Here's a patch implementing this. Being bitten by the missing coomma 
> > > problem was stimulating :)
> [...]
> > Improved patch catches the later two cases and doesn't report them. 
> > Because of this I've changed the Certainty field to 'certain'.
> 
> Did you forget to attach the updated patch? ;-)

Yuo, thanks for bugging me. Here it is.

-- 
dam
diff --git a/checks/control-file b/checks/control-file
index fb62cdd..5f9a7c1 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
+				([a-z][^,]*)		# next entry, must start with a letter
+				/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..f4fa2cf 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: certain
+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


Reply to: