Red Hat Bugzilla – Bug 469566
yum-cron makes /var/lock/yum-cron.lock directory instead of file
Last modified: 2009-08-05 16:07:29 EDT
The script /etc/cron.daily/yum.cron creates lock directory /var/lock/yum-cron.lock instead of file.
Because the file /etc/rc.d/rc.sysinit from initscripts package clean up /var/lock on system start but removes only files (except /var/lock/cvs and /var/run/screen directories), there is a probability, that stale lock dir /var/lock/yum-cron.lock is not removed on next restart and thus no updates will be applied ever more.
So please change "mkdir $LOCKFILE" to "touch $LOCKFILE" and "rmdir $LOCKFILE" to "rm -f $LOCKFILE".
Created attachment 322230 [details]
Use lock file instead of directory
There should be a test at the wery beginning of the script:
[ -d /var/lock/yum-cron.lock ] && rmdir /var/lock/yum-cron.lock
This command work around stale lock dir that should be deleted. Better solution may be %post script in the SPEC file or the stalled lock directory will break yum-cron for ever.
Bug 327401 complained that using a lockfile rather than a lock directory was a non-atomic operation that introduced a race condition, so yum-cron's lockfile was changed to a directory as a result. Can you please read that bug and see if you agree with the logic.
Regarding comment #2, will check to see what we've got going already for stale lockfile checking and get back to you. We can't just nuke any existing lockfile at the start of the script, or then it won't be able to actually prevent a second instance from running, so would need to store the pid in there so we can check if that pid is running too.
As of comment #2 (simple lock removal) - you may delete it safely because yum does its own locking so no conflict is dangerous here (only error message output through cron email until already-running process is done).
You are using bash shell so you may do proper locking this way:
set -o noclobber
echo > /var/lock/subsys/$LOCKNAME
[ $? -ne 0 ] && failure
set +o noclobber
Locking may be done by using "mv", but mv does not provide the ability to tell us that rename failed (but did so). Also locking may be done by using "ln" but as lock file is symlink then, one have to verify all lock-file checks (to accept symlink not only normal files) so this method may interferre other parts of the distribution. You may also write own portable locking function but this is worthless as we have bash and noclobber (also present in csh, tcsh and possibly other shells).
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '9'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 9's end of life.
Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 9 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
The process we are following is described here:
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version.
Thank you for reporting this bug and we are sorry it could not be fixed.
Continuing in Bug 515814, F9 was EOL'd before this one was resolved.