This is an automated email from the git hooks/post-receive script. lamby pushed a commit to branch master in repository lintian.
commit ca4fd17410de71cf49a0b6affc8829f77ff406ec Author: Chris Lamb <la...@debian.org> Date: Wed Sep 21 04:18:24 2016 +0100 c/debhelper: Check for .maintscript files that include "maint-script-parameters" --- checks/debhelper.desc | 8 ++++++++ checks/debhelper.pm | 10 ++++++++++ debian/changelog | 2 ++ .../debian/debian/maintscript | 4 ++++ t/tests/maintscript-includes-maint-script-parameters/desc | 6 ++++++ t/tests/maintscript-includes-maint-script-parameters/tags | 3 +++ 6 files changed, 33 insertions(+) diff --git a/checks/debhelper.desc b/checks/debhelper.desc index 9b9d046..3317d56 100644 --- a/checks/debhelper.desc +++ b/checks/debhelper.desc @@ -361,3 +361,11 @@ Info: The listed target in debian/rules command is a likely misspelling. Implementation detail: The typo is detected by using "Levenshtein edit distance". Therefore, if the typo involve several characters, Lintian may not detect it. + +Tag: maintscript-includes-maint-script-parameters +Severity: normal +Certainty: possible +Info: Lines in a <tt>debian/*.maintscript</tt> correspond to + <tt>dpkg-maintscript-helper(1)</tt> commands and parameters. However, the + "maint-script-parameters" should not be included as debhelper will add those + automatically. See <tt>dh_installdeb(1)</tt> for more information. diff --git a/checks/debhelper.pm b/checks/debhelper.pm index ee7ac59..32cbded 100644 --- a/checks/debhelper.pm +++ b/checks/debhelper.pm @@ -355,6 +355,16 @@ sub run { _tag_if_executable($file); } elsif ($basename =~ m/^ex\.|\.ex$/i) { tag 'dh-make-template-in-source', $file; + } elsif ($basename =~ m/^(?:(.*)\.)?maintscript$/) { + next unless $file->is_open_ok; + my $fd = $file->open; + while (<$fd>) { + if (m/--\s+"\$(?:@|{@})"\s*$/) { + tag 'maintscript-includes-maint-script-parameters', + $basename, "(line $.)"; + } + } + close($fd); } elsif ($basename =~ m/^(?:.+\.)?debhelper(?:\.log)?$/){ # The regex matches "debhelper", but debhelper/Dh_Lib does not # make those, so skip it. diff --git a/debian/changelog b/debian/changelog index c5f2859..ef9a811 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ lintian (2.5.48) UNRELEASED; urgency=low + [JW] Ignore comments in debian/rules. + [JW] Fix parsing rule targets in lines containing multiple colons. Thanks to Andreas Beckmann for the bug report. (Closes: #838246) + + [CL] Check for .maintscript files that include "maint-script-parameters". + (Closes: #838195) * checks/fields.desc: + [JW] Fix typo. * checks/testsuite.pm: diff --git a/t/tests/maintscript-includes-maint-script-parameters/debian/debian/maintscript b/t/tests/maintscript-includes-maint-script-parameters/debian/debian/maintscript new file mode 100644 index 0000000..6a583d7 --- /dev/null +++ b/t/tests/maintscript-includes-maint-script-parameters/debian/debian/maintscript @@ -0,0 +1,4 @@ +rm_conffile /etc/correct.conf 0.2~ foo +rm_conffile /etc/incorrect.conf 0.2~ foo -- "$@" +rm_conffile /etc/incorrect.conf 0.2~ foo -- "${@}" +rm_conffile /etc/incorrect.conf 0.2~ foo -- "$@" diff --git a/t/tests/maintscript-includes-maint-script-parameters/desc b/t/tests/maintscript-includes-maint-script-parameters/desc new file mode 100644 index 0000000..a4a3093 --- /dev/null +++ b/t/tests/maintscript-includes-maint-script-parameters/desc @@ -0,0 +1,6 @@ +Testname: maintscript-includes-maint-script-parameters +Sequence: 6000 +Version: 1.0 +Description: Check dh_installdeb .maintscript files +Test-For: + maintscript-includes-maint-script-parameters diff --git a/t/tests/maintscript-includes-maint-script-parameters/tags b/t/tests/maintscript-includes-maint-script-parameters/tags new file mode 100644 index 0000000..088f8c3 --- /dev/null +++ b/t/tests/maintscript-includes-maint-script-parameters/tags @@ -0,0 +1,3 @@ +W: maintscript-includes-maint-script-parameters source: maintscript-includes-maint-script-parameters maintscript (line 2) +W: maintscript-includes-maint-script-parameters source: maintscript-includes-maint-script-parameters maintscript (line 3) +W: maintscript-includes-maint-script-parameters source: maintscript-includes-maint-script-parameters maintscript (line 4) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git