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

Bug#807695: lintian: false positive for command-with-path-in-maintainer-script



* Axel Beckert <abe@debian.org>, 2015-12-11, 18:04:
Thorsten Glaser wrote:
I got a false positive for FusionForge in sid:

W: gforge-db-postgresql: command-with-path-in-maintainer-script postinst:8 /usr/bin/pg_lsclusters
[…]
N:    See particularly the function pathfind() in devref.

The line in question:

if [ -x /usr/bin/pg_lsclusters ]; then

Guillem Jover requested that command-with-path-in-maintainer-script should trigger also for "[ -x ... ]" constructs in #769845. Unfortunately, the tag description wasn't adequately updated when this change was implemented.

If you don't wish to hard-code the path of a command in your maintainer script, the following POSIX-compliant shell function may help:

 pathfind() {
   OLDIFS="$IFS"
   IFS=:
   for p in $PATH; do
       if [ -x "$p/$*" ]; then
           IFS="$OLDIFS"
           return 0
       fi
   done
   IFS="$OLDIFS"
   return 1
 }

Eww. There's no reason to use this monster in maintainer scripts. Please use which(1) instead. See also bug #747320.

--
Jakub Wilk


Reply to: