Bug#825047: developers-reference: Lintian contradicts suggestion in maintainer scripts best practices
Package: developers-reference
Version: 3.4.17
Severity: normal
I have a package with a postrm script that has a line like
[ -x /usr/bin/ucf ] && ucf --purge /etc/default/gridengine
which incurs the following lintian warning:
W: gridengine-common: command-with-path-in-maintainer-script postrm:31 /usr/bin/ucf
N:
N: The indicated program run in a maintainer script has a prepended path.
N: Programs called from maintainer scripts normally should not have a path
N: prepended. dpkg ensures that the PATH is set to a reasonable value, and
N: prepending a path may prevent the local administrator from using a
N: replacement version of a command for some local reason.
N:
N: If the path is required to test a program for existence, one of the
N: suggested workarounds in the developer's reference can be used.
N:
N: See particularly the function pathfind() in devref.
N:
N: Refer to Debian Policy Manual section 6.1 (Introduction to package
N: maintainer scripts) and Debian Developer's Reference section 6.4 (Best
N: practices for maintainer scripts) for details.
N:
N: Severity: normal, Certainty: certain
N:
N: Check: scripts, Type: binary
However, in the developer's reference (section 6.4), we have:
~~~
If you need to check for the existence of a command, you should use something like
if [ -x /usr/sbin/install-docs ]; then ...
If you don't wish to hard-code the path of a command in your maintainer script,...
~~~
Given the lintian warning above, the first suggestion quoted here probably should not be made in the Developer's reference.
Many thanks and regards
Afif
Reply to: