Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 353270 - sys-apps/mlocate-0.23.1-r1: /etc/cron.daily/mlocate errors
Summary: sys-apps/mlocate-0.23.1-r1: /etc/cron.daily/mlocate errors
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Christian Faulhammer (RETIRED)
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2011-01-31 00:17 UTC by Alexander Miller
Modified: 2011-01-31 13:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Miller 2011-01-31 00:17:52 UTC
When I merged the new config files I noticed two errors in the cron script:

1) When /etc/updatedb.conf is missing the ARGS for /usr/bin/updatedb are invalid (the list for -f must be passed as a single argument). I renamed /etc/updatedb.conf to test it and got:
/usr/bin/updatedb: unexpected operand on command line
There are several ways you could fix it:
(a) Quote the list and use eval, i.e., replace
    ARGS="-f ${nodevs}"
on line 32 with
    ARGS="-f '${nodevs}'"
and
    /usr/bin/updatedb ${ARGS}
on line 45 with
    eval /usr/bin/updatedb ${ARGS}

-OR-
(b) Set ARGS=$(<... awk...) (without -f) and later call /usr/bin/updatedb -f "${ARGS}" (empty argument to -f is OK)

2) An already present lockfile will be removed by the second running instance of the script. If a third instance starts before the first one has finished, it won't see the lock. (updatedb running +2 days is not funny anyway, but if you do locking, then do it right.)
You should set the trap right before 'touch "${LOCKFILE}"' to fix it, i.e., replace
  trap "rm -f ${LOCKFILE}" EXIT
  if [ -e "${LOCKFILE}" ]; then
        echo >&2 "Warning: \"${LOCKFILE}\" already present, not running updatedb
."
        exit 1
  else
        touch "${LOCKFILE}"
  fi
with
  if [ -e "${LOCKFILE}" ]; then
        echo >&2 "Warning: \"${LOCKFILE}\" already present, not running updatedb
."
        exit 1
  fi
  trap "rm -f ${LOCKFILE}" EXIT
  touch "${LOCKFILE}"
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2011-01-31 05:18:20 UTC
Please don't CC others when you cannot assign bugs.
Comment 2 Tomáš Chvátal (RETIRED) gentoo-dev 2011-01-31 13:18:10 UTC
+  31 Jan 2011; Tomáš Chvátal <scarabeus@gentoo.org> files/mlocate.cron-r2:
+  Fix premature removing of the lock file and parse the args more sanely when
+  there is no config around. This fixes bug #353270.
+