Public bug reported:

Binary package hint: mlocate

The mlocate cron job (/etc/cron.daily/mlocate) doesn't always respect
its lockfile.  The cron job always removes the lockfile, even if it
aborts because the lockfile already exists.  The result is that every
other concurrent invocation of /etc/cron.daily/mlocate will run
updatedb.

The bug is pretty obvious.  From /etc/cron.daily/mlocate:

-----
trap "rm -f $LOCKFILE" EXIT

if [ -e "$LOCKFILE" ]; then
    echo >&2 "Warning: $LOCKFILE present, not running updatedb."
    exit 1
else
    touch "$LOCKFILE"
fi
-----

The trap to remove the lockfile is turned on before checking for the
existence of the lockfile.  So even if the lockfile exists, we rm it on
exit.  Moving the trap inside the else block should fix it.


# lsb_release -rd         
Description:    Ubuntu 10.04 LTS
Release:        10.04

# apt-cache policy mlocate
mlocate:
  Installed: 0.22.2-1ubuntu1
  Candidate: 0.22.2-1ubuntu1

** Affects: mlocate (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/731632

Title:
  mlocate cron job doesn't respect its lockfile

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to