[lintian] 01/01: Emit new empty-section-field tag instead of uninitialized value warnings on an empty "Section:" field. (Closes: #878515)

2017-10-24 Thread Chris Lamb
This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository lintian.

commit 8e5b05587f58c757cfe88cb095ca77805c181c66
Author: Chris Lamb 
Date:   Tue Oct 24 23:12:06 2017 -0400

Emit new empty-section-field tag instead of uninitialized value warnings on 
an empty "Section:" field. (Closes: #878515)
---
 checks/fields.desc| 6 ++
 checks/fields.pm  | 4 +++-
 debian/changelog  | 2 ++
 t/debs/fields-general-bad/control | 2 +-
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/checks/fields.desc b/checks/fields.desc
index 2ada4c0..da6cfc6 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -1331,3 +1331,9 @@ Info: Since Debian Policy version 4.0.1, the priority 
extra
  Please update debian/control and replace all instances of
  Priority: extra with Priority: optional.
 Ref: policy 2.5
+
+Tag: empty-section-field
+Severity: normal
+Certainty: certain
+Info: The "Section:" field in this package's control file is empty.
+Ref: policy 2.4
diff --git a/checks/fields.pm b/checks/fields.pm
index 3a5de15..9dbeb2e 100644
--- a/checks/fields.pm
+++ b/checks/fields.pm
@@ -520,13 +520,15 @@ sub run {
 tag 'wrong-section-for-udeb', $section;
 }
 } else {
-my @parts = split(m{/}, $section, 2);
+my @parts = split(m{/}, $section, 2) || ('');
 
 if (scalar @parts > 1) {
 tag 'unknown-section', $section
   unless $KNOWN_ARCHIVE_PARTS{$parts[0]};
 tag 'unknown-section', $section
   unless $KNOWN_SECTIONS->known($parts[1]);
+} elsif ($parts[0] eq '') {
+tag 'empty-section-field';
 } elsif ($parts[0] eq 'unknown') {
 tag 'section-is-dh_make-template';
 } else {
diff --git a/debian/changelog b/debian/changelog
index 2d64e4d..e5d9b00 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,8 @@ lintian (2.5.56) UNRELEASED; urgency=medium
   * checks/fields.pm:
 + [CL] Apply patch from Nicolas Boulenguez to accept and recommend the
   new vcs-mtn mtn:// uri format.  (Closes: #878798)
++ [CL] Emit new empty-section-field tag instead of uninitialized value
+  warnings on an empty "Section:" field.  (Closes: #878515)
   * checks/init.d.pm:
 + [CL] Check for files that use content from the /etc/init.d/skeleton
   template. Thanks to Christoph Biedl for the idea.  (Closes: #879152)
diff --git a/t/debs/fields-general-bad/control 
b/t/debs/fields-general-bad/control
index a23dd29..4fbd0ee 100644
--- a/t/debs/fields-general-bad/control
+++ b/t/debs/fields-general-bad/control
@@ -3,7 +3,7 @@ Source: fields-general-bad
 Version: 1.0?
 Architecture: weird i386 amd64
 Maintainer: Debian Lintian Maintainers 
-Section: devel
+Section:
 Priority: is
  weird
 Unknown-Field: Hallo World

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/lintian/lintian.git



[lintian] 01/01: Emit new empty-section-field tag instead of uninitialized value warnings on an empty "Section:" field. (Closes: #878515)

2017-10-25 Thread Chris Lamb
This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository lintian.

commit ee0aaf340c434776f93bf7becbf66216763072a7
Author: Chris Lamb 
Date:   Tue Oct 24 23:12:06 2017 -0400

Emit new empty-section-field tag instead of uninitialized value warnings on 
an empty "Section:" field. (Closes: #878515)
---
 checks/fields.desc| 6 ++
 checks/fields.pm  | 4 +++-
 debian/changelog  | 2 ++
 t/debs/fields-general-bad/control | 2 +-
 t/debs/fields-general-bad/desc| 1 +
 t/debs/fields-general-bad/tags| 1 +
 6 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/checks/fields.desc b/checks/fields.desc
index 2ada4c0..da6cfc6 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -1331,3 +1331,9 @@ Info: Since Debian Policy version 4.0.1, the priority 
extra
  Please update debian/control and replace all instances of
  Priority: extra with Priority: optional.
 Ref: policy 2.5
+
+Tag: empty-section-field
+Severity: normal
+Certainty: certain
+Info: The "Section:" field in this package's control file is empty.
+Ref: policy 2.4
diff --git a/checks/fields.pm b/checks/fields.pm
index 3a5de15..39fc18f 100644
--- a/checks/fields.pm
+++ b/checks/fields.pm
@@ -515,7 +515,9 @@ sub run {
 
 unfold('section', \$section);
 
-if ($type eq 'udeb') {
+if ($section eq '') {
+tag 'empty-section-field';
+} elsif ($type eq 'udeb') {
 unless ($section eq 'debian-installer') {
 tag 'wrong-section-for-udeb', $section;
 }
diff --git a/debian/changelog b/debian/changelog
index 2d64e4d..e5d9b00 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,8 @@ lintian (2.5.56) UNRELEASED; urgency=medium
   * checks/fields.pm:
 + [CL] Apply patch from Nicolas Boulenguez to accept and recommend the
   new vcs-mtn mtn:// uri format.  (Closes: #878798)
++ [CL] Emit new empty-section-field tag instead of uninitialized value
+  warnings on an empty "Section:" field.  (Closes: #878515)
   * checks/init.d.pm:
 + [CL] Check for files that use content from the /etc/init.d/skeleton
   template. Thanks to Christoph Biedl for the idea.  (Closes: #879152)
diff --git a/t/debs/fields-general-bad/control 
b/t/debs/fields-general-bad/control
index a23dd29..4fbd0ee 100644
--- a/t/debs/fields-general-bad/control
+++ b/t/debs/fields-general-bad/control
@@ -3,7 +3,7 @@ Source: fields-general-bad
 Version: 1.0?
 Architecture: weird i386 amd64
 Maintainer: Debian Lintian Maintainers 
-Section: devel
+Section:
 Priority: is
  weird
 Unknown-Field: Hallo World
diff --git a/t/debs/fields-general-bad/desc b/t/debs/fields-general-bad/desc
index 79fd5db..3542045 100644
--- a/t/debs/fields-general-bad/desc
+++ b/t/debs/fields-general-bad/desc
@@ -7,6 +7,7 @@ Test-For:
  bad-relation
  bad-version-in-relation
  bad-version-number
+ empty-section-field
  multiline-field
  package-not-lowercase
  too-many-architectures
diff --git a/t/debs/fields-general-bad/tags b/t/debs/fields-general-bad/tags
index 993ec2d..c39f8a9 100644
--- a/t/debs/fields-general-bad/tags
+++ b/t/debs/fields-general-bad/tags
@@ -9,6 +9,7 @@ E: fields-general-BAD?: package-not-lowercase
 E: fields-general-BAD?: too-many-architectures
 E: fields-general-BAD?: unknown-priority is weird
 I: fields-general-BAD?: unknown-field-in-control unknown-field
+W: fields-general-BAD?: empty-section-field
 W: fields-general-BAD?: file-name-contains-wildcard-character 
usr/share/doc/fields-general-BAD?/
 W: fields-general-BAD?: file-name-contains-wildcard-character 
usr/share/doc/fields-general-BAD?/changelog.gz
 W: fields-general-BAD?: file-name-contains-wildcard-character 
usr/share/doc/fields-general-BAD?/copyright

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/lintian/lintian.git