Bug 469566 - yum-cron makes /var/lock/yum-cron.lock directory instead of file
yum-cron makes /var/lock/yum-cron.lock directory instead of file
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: yum-cron (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Habig, Alec
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-02 11:32 EST by Milan Kerslager
Modified: 2009-08-05 16:07 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-07-14 12:45:06 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Use lock file instead of directory (655 bytes, patch)
2008-11-02 11:47 EST, Milan Kerslager
no flags Details | Diff

  None (edit)
Description Milan Kerslager 2008-11-02 11:32:48 EST
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".
Comment 1 Milan Kerslager 2008-11-02 11:47:54 EST
Created attachment 322230 [details]
Use lock file instead of directory
Comment 2 Milan Kerslager 2008-11-02 11:58:24 EST
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.
Comment 3 Habig, Alec 2008-11-03 14:45:48 EST
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.
Comment 4 Milan Kerslager 2008-11-04 05:51:55 EST
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:

LOCKNAME=yum-cron
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).
Comment 5 Bug Zapper 2009-06-09 23:09:10 EDT
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: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 6 Bug Zapper 2009-07-14 12:45:06 EDT
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.
Comment 7 Habig, Alec 2009-08-05 16:07:29 EDT
Continuing in Bug 515814, F9 was EOL'd before this one was resolved.

Note You need to log in before you can comment on or make changes to this bug.