Package: aide
Version: 0.11a-3
Severity: normal

The test for the presence of dotlockfile is incorrect.  It fails to
detect if dotlockfile is not installed.

  if [ -x $(which dotlockfile) ]; then
    ...
  else
    echo >&2 "no dotlockfile binary in path, not checking for already running 
aide"
  fi

However if dotlockfile is not found then it expands to a newline and
the test for -x on a newline is true.

  test -x $(which does-not-exist) && echo yes || echo no
  yes

  test -x $(echo) && echo yes || echo no
  yes

The developers reference contains some suggestions for dealing with
this type of situation.

  
http://www.us.debian.org/doc/developers-reference/ch-best-pkging-practices.en.html#s-bpp-debian-maint-scripts

Here is a suggested fix based upon those recommendations.  Although
many other good solutions also exist.

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

if pathfind dotlockfile; then
  if ! dotlockfile -p -l $LOCKFILE; then
    echo >&2 "cannot obtain lock $LOCKFILE, stale lock?"
    exit 1
  fi
else
  echo >&2 "no dotlockfile binary in path, not checking for already running 
aide"
fi

Thanks
Bob

-- 
Bob Proulx <[EMAIL PROTECTED]>
http://www.proulx.com/~bob/


-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.8-3-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages aide depends on:
ii  liblockfile1     1.06                    NFS-safe locking library, includes


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to