Bug#761125: lintian: false positive of wildcard-matches-nothing-in-dep5-copyright if Files field starts with whitespace
Package: lintian
Version: 2.5.26
Severity: normal
Tags: patch
Hi,
Consider the following paragraph of a copyright-format 1.0 file:
Files:
foo
bar
Copyright: xxx
License: xxx
Even if files foo and bar exist, this will emit
wildcard-matches-nothing-in-dep5-copyright. The reason is, that the
value of the Files field starts with whitespace. Therefore, when
splitting the field value by whitespace, the first value is the empty
string. The empty string matches nothing.
The attached patch fixes the issue.
cheers, josch
-- System Information:
Debian Release: jessie/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.14-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages lintian depends on:
ii binutils 2.24.51.20140617-1
ii bzip2 1.0.6-5
ii diffstat 1.58-1
ii file 1:5.19-1
ii gettext 0.18.3.2-3
ii hardening-includes 2.5
ii intltool-debian 0.35.0+20060710.1
ii libapt-pkg-perl 0.1.29+b1
ii libarchive-zip-perl 1.37-2
ii libclass-accessor-perl 0.34-1
ii libclone-perl 0.37-1
ii libdpkg-perl 1.17.13
ii libemail-valid-perl 1.194-1
ii libfile-basedir-perl 0.03-1
ii libipc-run-perl 0.92-1
ii liblist-moreutils-perl 0.33-2
ii libparse-debianchangelog-perl 1.2.0-1
ii libtext-levenshtein-perl 0.09-1
ii libtimedate-perl 2.3000-2
ii liburi-perl 1.62-1
ii man-db 2.6.7.1-1
ii patchutils 0.3.3-1
ii perl [libdigest-sha-perl] 5.18.2-6
ii t1utils 1.37-2
Versions of packages lintian recommends:
ii libautodie-perl 2.25-1
ii libperlio-gzip-perl 0.18-3
ii perl 5.18.2-6
ii perl-modules [libautodie-perl] 5.18.2-6
Versions of packages lintian suggests:
pn binutils-multiarch <none>
ii dpkg-dev 1.17.13
ii libhtml-parser-perl 3.71-1+b1
ii libtext-template-perl 1.46-1
ii libyaml-perl 0.95-1
ii xz-utils 5.1.1alpha+20120614-2
-- no debconf information
>From bf8321f6da83acadb57e9d162c991bcaad383845 Mon Sep 17 00:00:00 2001
From: josch <j.schauer@email.de>
Date: Wed, 10 Sep 2014 22:14:46 +0200
Subject: [PATCH] fix a false positive of
wildcard-matches-nothing-in-dep5-copyright
- wrongly emitted the tag when first line was empty
---
checks/source-copyright.pm | 4 ++++
t/tests/source-copyright-wildcard-matching/debian/debian/copyright | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/checks/source-copyright.pm b/checks/source-copyright.pm
index 40ac36e..1593fda 100644
--- a/checks/source-copyright.pm
+++ b/checks/source-copyright.pm
@@ -311,6 +311,10 @@ sub _parse_dep5 {
if (not @commas_in_files or $commas_in_files) {
my @wildcards = split /[\n\t ]+/, $files;
for my $wildcard (@wildcards) {
+ $wildcard =~ s/^\s+|\s+$//g;
+ if ($wildcard eq "") {
+ next;
+ }
my ($regex, $wildcard_error)= wildcard_to_regex($wildcard);
if (defined $wildcard_error) {
tag 'invalid-escape-sequence-in-dep5-copyright',
diff --git a/t/tests/source-copyright-wildcard-matching/debian/debian/copyright b/t/tests/source-copyright-wildcard-matching/debian/debian/copyright
index 2e7cc75..37ca88d 100644
--- a/t/tests/source-copyright-wildcard-matching/debian/debian/copyright
+++ b/t/tests/source-copyright-wildcard-matching/debian/debian/copyright
@@ -26,8 +26,10 @@ Copyright: 2014, somebody1
License: mylicense
Fixme
-Files: file,with,commas
+Files:
+ file,with,commas
Copyright: 2014, somebody1
+Comment: this paragraph starts with a newline and ends with a space
License: mylicense
Fixme
--
2.0.1
Reply to: