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

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



Hi,

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
> 
> OK, I looked into devref, and it explicitly says:
> 
>     If you need to check for the existence of a command, you should
>     use something like
> 
>     if [ -x /usr/sbin/install-docs ]; then ...

And if you read just one paragraph further:

  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
  }

I guess _that_ is the part, Lintian refers, too.

But besides that, I'm also annoyed by that warning and tend to ignore
it. I don't think, forbidding "if [ -x /usr/*bin/* ];" adds any value.
Especially not if you're supposed to add like a dozen lines of sh code
instead which is surely more error-prone than that single line.

(In case someone disagrees: Have a look at one of the reasons why
systemd is said to be soooo much better since it has no more init
scripts... :-P)

		Regards, Axel
-- 
 ,''`.  |  Axel Beckert <abe@debian.org>, http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-    |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE


Reply to: