tag 348620 patch thanks Hi all,
Attached is the patch implementing that check. Cheers, -- Atomo64 - Raphael Please avoid sending me Word, PowerPoint or Excel attachments. See http://www.gnu.org/philosophy/no-word-attachments.html
diff --git a/checks/scripts b/checks/scripts index ec826c4..a6b5173 100644 --- a/checks/scripts +++ b/checks/scripts @@ -485,6 +485,7 @@ while (<SCRIPTS>) { my %warned; my ($saw_init, $saw_invoke, $saw_debconf, $has_code); my $cat_string = ""; + my $LEADIN = qr'(?:(?:^|[`&;(|{])\s*|(?:if|then|do|while)\s+)'; while (<C>) { next if m,^\s*$,; # skip empty lines @@ -549,7 +550,6 @@ while (<SCRIPTS>) { if ($cat_string eq "" and $checkbashisms and !$within_another_shell) { my $found = 0; my $match = ''; - my $LEADIN = qr'(?:(^|[`&;(|{])\s*|(if|then|do|while)\s+)'; my @bashism_single_quote_regexs = ( $LEADIN . qr'echo\s+(?:-[^e\s]+\s+)?\'[^\']*(\\[\\abcEfnrtv0])+.*?[\']', # unsafe echo with backslashes @@ -758,6 +758,9 @@ while (<SCRIPTS>) { tag "maintainer-script-modifies-inetd-conf", "$file:$." unless Dep::implies($deps{provides}, Dep::parse('inet-superserver')); } + if (m,^$LEADIN(/(usr/(local/)?)?s?bin/\w+),) { + tag "useless-std-path-in-maintainer-script", "$file:$. $1"; + } # Ancient dpkg feature tests. if (m/^\s*dpkg\s+--assert-support-predepends\b/) { diff --git a/checks/scripts.desc b/checks/scripts.desc index 8d3dced..3026180 100644 --- a/checks/scripts.desc +++ b/checks/scripts.desc @@ -425,6 +425,12 @@ Info: The package calls dpkg --assert-multi-conrep in a maintainer script. This check is obsolete and has always returned true since dpkg 1.4.1.19, released 1999-10-30. +Tag: useless-std-path-in-maintainer-script +Type: warning +Ref: policy 6.1 +Info: The script runs an executable which has a, useless, path that is + included in the default $PATH. + Tag: maintainer-script-modifies-php.ini Type: warning Ref: http://wiki.debian.org/PHP diff --git a/testset/maintainer-scripts/debian/preinst b/testset/maintainer-scripts/debian/preinst index 01f0fee..bb97763 100644 --- a/testset/maintainer-scripts/debian/preinst +++ b/testset/maintainer-scripts/debian/preinst @@ -8,3 +8,5 @@ dpkg --assert-support-predepends || exit 1 dpkg --assert-working-epoch || exit 1 dpkg --assert-long-filenames || exit 1 dpkg --assert-multi-conrep || exit 1 + +/bin/egrep --mmap "^Package: foo$" /var/lib/dpkg/status diff --git a/testset/tags.maintainer-scripts b/testset/tags.maintainer-scripts index 80cc1b6..dfe9ed5 100644 --- a/testset/tags.maintainer-scripts +++ b/testset/tags.maintainer-scripts @@ -19,6 +19,7 @@ E: maintainer-scripts: maintainer-script-modifies-netbase-managed-file postinst: E: maintainer-scripts: maintainer-script-removes-device-files postrm:39 E: maintainer-scripts: maintainer-script-removes-device-files postrm:40 E: maintainer-scripts: maintainer-script-uses-dpkg-status-directly postinst +E: maintainer-scripts: maintainer-script-uses-dpkg-status-directly preinst E: maintainer-scripts: maintainer-shell-script-fails-syntax-check prerm E: maintainer-scripts: no-copyright-file E: maintainer-scripts: postrm-contains-additional-updaterc.d-calls /etc/init.d/bar @@ -150,3 +151,4 @@ W: maintainer-scripts: read-in-maintainer-script prerm:65 W: maintainer-scripts: read-in-maintainer-script prerm:66 W: maintainer-scripts: start-stop-daemon-in-maintainer-script postinst:161 W: maintainer-scripts: update-alternatives-remove-called-in-postrm +W: maintainer-scripts: useless-std-path-in-maintainer-script preinst:12 /bin/egrep