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

[lintian] 01/01: c/files: Warn if file name contains shell wildcard characters. (Closes: #814326)



This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch warn-if-filenames-contain-wildcard-characters-814326
in repository lintian.

commit 95b7c75133961abb3e15f9b602ccbad750bc8d78
Author: Chris Lamb <lamby@debian.org>
Date:   Sat Aug 27 11:39:10 2016 +0100

    c/files: Warn if file name contains shell wildcard characters. (Closes: #814326)
    
    Signed-off-by: Chris Lamb <lamby@debian.org>
---
 checks/files.desc                                     |  8 ++++++++
 checks/files.pm                                       |  4 ++++
 t/tests/files-wildcard-characters/debian/.coverage    |  0
 t/tests/files-wildcard-characters/debian/debian/rules | 11 +++++++++++
 t/tests/files-wildcard-characters/desc                |  6 ++++++
 t/tests/files-wildcard-characters/tags                |  2 ++
 6 files changed, 31 insertions(+)

diff --git a/checks/files.desc b/checks/files.desc
index 5ddc26b..8efd01b 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -1675,6 +1675,14 @@ Info: The given file is in PATH but consists of non-ASCII characters.
  Note that Lintian may be unable to display the filename accurately.
  Unprintable characters may have been replaced.
 
+Tag: file-name-contains-wildcard-character
+Severity: normal
+Certainty: possible
+Info: The file name contains shell wildcard characters.
+ .
+ These are most likely unexpanded wildcard characters from (for example)
+ <tt>debian/*.install</tt> files, or it may have been installed by accident.
+
 Tag: incorrect-naming-of-pkcs11-module
 Severity: important
 Certainty: certain
diff --git a/checks/files.pm b/checks/files.pm
index b546cf9..0266311 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -364,6 +364,10 @@ sub run {
             tag 'file-name-is-not-valid-UTF-8', $file;
         }
 
+        if ($fname =~ m,[*?],) {
+          tag 'file-name-contains-wildcard-character', $file;
+        }
+
         if ($file->is_hardlink) {
             my $link_target_dir = $link;
             $link_target_dir =~ s,[^/]*$,,;
diff --git a/t/tests/files-wildcard-characters/debian/.coverage b/t/tests/files-wildcard-characters/debian/.coverage
new file mode 100644
index 0000000..e69de29
diff --git a/t/tests/files-wildcard-characters/debian/debian/rules b/t/tests/files-wildcard-characters/debian/debian/rules
new file mode 100755
index 0000000..c14beca
--- /dev/null
+++ b/t/tests/files-wildcard-characters/debian/debian/rules
@@ -0,0 +1,11 @@
+#!/usr/bin/make -f
+
+PREFIX = $(CURDIR)/debian/files-wildcard-characters/usr/share/files-wildcard-characters
+
+%:
+	dh $@
+
+override_dh_auto_install:
+	mkdir -p $(PREFIX)
+	touch $(PREFIX)/star*
+	touch $(PREFIX)/question-mark?
diff --git a/t/tests/files-wildcard-characters/desc b/t/tests/files-wildcard-characters/desc
new file mode 100644
index 0000000..c8a779f
--- /dev/null
+++ b/t/tests/files-wildcard-characters/desc
@@ -0,0 +1,6 @@
+Testname: files-wildcard-characters
+Sequence: 6000
+Version: 1.0
+Description: Check for wildcard characters in filenames
+Test-For:
+ file-name-contains-wildcard-character
diff --git a/t/tests/files-wildcard-characters/tags b/t/tests/files-wildcard-characters/tags
new file mode 100644
index 0000000..d1ccd8a
--- /dev/null
+++ b/t/tests/files-wildcard-characters/tags
@@ -0,0 +1,2 @@
+W: files-wildcard-characters: file-name-contains-wildcard-character usr/share/files-wildcard-characters/question-mark?
+W: files-wildcard-characters: file-name-contains-wildcard-character usr/share/files-wildcard-characters/star*

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


Reply to: