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

[SCM] Debian package checker branch, master, updated. 2.1.5-19-g5f24b01



The following commit has been merged in the master branch:
commit 5f24b011df20f21efbf15d618628b19c2c71dcac
Author: Russ Allbery <rra@debian.org>
Date:   Sat Jan 17 13:18:36 2009 -0800

    Check for missing commas after substvars
    
    * checks/control-file{,.desc}:
      + [RA] Check for missing commas after substvars in dependency fields.
        Thanks, Jari Aalto.  (Closes: #409099)

diff --git a/checks/control-file b/checks/control-file
index 0709eab..019bf79 100644
--- a/checks/control-file
+++ b/checks/control-file
@@ -79,6 +79,21 @@ for my $binary_control (@binary_controls) {
 		tag 'binary-control-field-duplicates-source', "field \"$field\" in package ".$binary_control->{'package'},
 		    if ($header->{$field} && $binary_control->{$field} eq $header->{$field});
 	}
+
+	# If two substvars aren't separated by a comma, but at least one of
+	# them expands to an empty string, there will be a lurking bug.  The
+	# result will be syntactically correct, but as soon as both expand
+	# into something non-empty, there will be a syntax error.  Catch that
+	# mistake to avoid problems later.
+	#
+	# Only check the fields that use comma-separated values.
+	for my $field (qw(pre-depends depends recommends suggests breaks
+			  conflicts provides replaces enhances)) {
+		next unless $binary_control->{$field};
+		if ($binary_control->{$field} =~ /(\$\{\S+\})\s+[a-zA-Z0-9\$]/) {
+			tag 'missing-comma-after-substvar', "in $field field near $1";
+		}
+	}
 }
 
 # Make sure that a stronger dependency field doesn't imply any of the elements
diff --git a/checks/control-file.desc b/checks/control-file.desc
index 0aba219..c57db3c 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -121,3 +121,14 @@ Info: The listed binary packages all share the same extended description.
  is in each package and how it differs from the other packages is useful,
  particularly for users who arne't familiar with Debian's package naming
  conventions.
+
+Tag: missing-comma-after-substvar
+Severity: normal
+Certainty: possible
+Info: The given field in the <tt>debian/control</tt> file has a substvar
+ (something of the form <tt>${Variable}</tt>) that isn't followed by a
+ comma.  This is normally a lurking bug.  As long as the variable isn't
+ defined or expands to an empty string, the generated control file will be
+ syntactically valid, but as soon as the variable has a non-empty value,
+ the control file will have a syntax error.  You probably meant to put a
+ comma after the substvar expansion.
diff --git a/debian/changelog b/debian/changelog
index cb9ffbc..a5da759 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,8 +7,12 @@ lintian (2.1.6) UNRELEASED; urgency=low
       - duplicate-uploader
       - empty-debian-diff
       - malformed-changes-file
+      - missing-comma-after-substvar
       - source-contains-hg-tags-file
 
+  * checks/control-file{,.desc}:
+    + [RA] Check for missing commas after substvars in dependency fields.
+      Thanks, Jari Aalto.  (Closes: #409099)
   * checks/cruft{,.desc}:
     + [RA] Error on CMakeCache.txt files added or modified in the diff.
       Thanks, Joerg Jaspert.  (Closes: #510957)
diff --git a/t/tests/6000_control-file-general.desc b/t/tests/6000_control-file-general.desc
index 668a26b..f1b840f 100644
--- a/t/tests/6000_control-file-general.desc
+++ b/t/tests/6000_control-file-general.desc
@@ -6,7 +6,8 @@ Test-For:
  build-info-in-binary-control-file-section
  duplicate-long-description
  duplicate-short-description
+ missing-comma-after-substvar
  no-section-field-for-source
  package-depends-on-itself
  stronger-dependency-implies-weaker
-References: Debian Bug#30020
+References: Debian Bug#30020, Debian Bug#409099
diff --git a/t/tests/control-file-general/debian/debian/control.in b/t/tests/control-file-general/debian/debian/control.in
index c8f4c24..1dae00a 100644
--- a/t/tests/control-file-general/debian/debian/control.in
+++ b/t/tests/control-file-general/debian/debian/control.in
@@ -10,7 +10,7 @@ Section: {$section}
 Maintainer: {$author}
 Build-Conflicts: foo
 Architecture: {$architecture}
-Depends: {$srcpkg}, foo, baz, $\{shlibs:Depends\}, $\{misc:Depends\}
+Depends: {$srcpkg}, foo, baz, $\{shlibs:Depends\} $\{misc:Depends\}
 Recommends: foo, bar
 Suggests: bar | baz
 Description: {$description}
diff --git a/t/tests/control-file-general/tags b/t/tests/control-file-general/tags
index 56b5297..d44bdb7 100644
--- a/t/tests/control-file-general/tags
+++ b/t/tests/control-file-general/tags
@@ -2,6 +2,7 @@ E: control-file-general source: build-info-in-binary-control-file-section Packag
 I: control-file-general source: binary-control-field-duplicates-source field "maintainer" in package control-file-general
 I: control-file-general source: duplicate-long-description control-file-general control-file-general-1 control-file-general-2
 I: control-file-general source: duplicate-short-description control-file-general control-file-general-1
+W: control-file-general source: missing-comma-after-substvar in depends field near ${shlibs:Depends}
 W: control-file-general source: no-section-field-for-source
 W: control-file-general source: package-depends-on-itself control-file-general depends
 W: control-file-general source: stronger-dependency-implies-weaker control-file-general depends -> recommends foo

-- 
Debian package checker


Reply to: