Bug 269961

Summary: run-parts /etc/cron.daily does not work after update to crontabs-1.10-15.fc7
Product: [Fedora] Fedora Reporter: s_h_o_
Component: crontabsAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: medium    
Version: 7CC: 2, admin, amessina, ben, bojan, ctm, deknuydt, drees76, goodyca48, gustavo, horsley1953, jr-redhatbugs2, mike, nigel, orchard, pb--bugzilla, richardfearn, subscribed-lists, thomas, tjb, vchepkov, yeti
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: crontabs-1.10-16.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-09-05 23:33:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description s_h_o_ 2007-08-31 00:41:39 UTC
Description of problem:
run-parts /etc/cron.daily does not work after update to crontabs-1.10-15.fc7

Version-Release number of selected component (if applicable):
crontabs-1.10-15.fc7

How reproducible:
Always

Steps to Reproduce:
1. At 4:02 am, cron starts "run-parts /etc/cron.daily".
  
Actual results:
The contents of /etc/cron/daily are not executed

Expected results:
The contents of /etc/cron/daily should be executed


Additional info:
I think the /usr/bin/run-parts is wrong.

 -----------------------
#!/bin/bash
# if cron.daily was run today
AUX1=`cat /var/spool/anacron/cron.daily`
AUX2=`date +%Y%m%d`
[ "$AUX1" == $AUX2 ] || exit 0

This should be
[ "$AUX1" == $AUX2 ] && exit 0

Comment 1 s_h_o_ 2007-08-31 00:50:17 UTC
Sorry. Typo (/etc/cron/daily -> /etc/cron.daily).

Actual results:
The contents of /etc/cron.daily are not executed

Expected results:
The contents of /etc/cron.daily should be executed


Comment 2 Marcela Mašláňová 2007-08-31 08:02:45 UTC
Already fixed in crontabs-1.10-16.fc7. Problem was that there is no such file
like cron.daily in F-7 (in devel exists).

Comment 3 Marcela Mašláňová 2007-08-31 08:02:57 UTC
*** Bug 264741 has been marked as a duplicate of this bug. ***

Comment 4 Mike Lilley 2007-08-31 14:42:37 UTC
Doesn't having this check for cron.daily in the run-parts script affect all cron
jobs?

In particular, unless I'm misunderstanding the mechanisms involved, once anacron
has updated its time stamp, no cron jobs will be run for the remainder of that
day (including hourly and monthly runs).  Since the default cron.daily forces an
update of anacron timestamps (at least on my system, which I haven't knowingly
altered from the default), this seems likely to cause problems.

Comment 5 Tom Horsley 2007-08-31 19:44:27 UTC
Yea, I agree with comment #4. Whatever the problem the change to run-parts
was trying to fix, this isn't the way to fix it, that change should just
be backed out, run-parts is used for each of the hourly, daily, weekly, and
monthly script invocations, and checking something that only makes sense
for daily is a bad idea.

Comment 6 David Rees 2007-09-01 00:05:21 UTC
When is this due to hit updates-testing or updates? I'm not seeing it and
getting spammed hourly by cron is highly annoying.

Comment 7 Piete Brooks 2007-09-01 06:23:09 UTC
I agree with comment #5

I also fear that as it causes cron jobs not to run, machines which use cron to
update RPMs will never pick up the fixed RPM.

Comment 8 Nigel Metheringham 2007-09-01 08:00:32 UTC
Bug #271501 is a duplicate of this.

Comment 9 pigetak178 2007-09-01 11:40:33 UTC
Still broken.  What's the problem with backing out the update until a fix is
provided.

Comment 10 Vadym Chepkov 2007-09-01 12:09:23 UTC
check of cron.daily file in run-parts is completely illogical, what about 
hourly jobs, for instance?

This should be removed from /usr/bin/run-parts:

# if cron.daily was run today
AUX1=`cat /var/spool/anacron/cron.daily`
AUX2=`date +%Y%m%d`
[ "$AUX1" == $AUX2 ] || exit 0
 

Comment 11 Anduin Withers 2007-09-02 19:37:04 UTC
In addition to the other flaws already pointed out, this change requires run-
parts to run as root (to have access to /var/spool/anacron/cron.daily). If some 
version of this change is going to remain, please do some more checking so non-
root can continue to use run-parts.

Comment 12 Greg Trounson 2007-09-03 04:03:04 UTC
Installing crontabs-1.10-16.fc8 from Fedora devel didn't seem to help me - the
offending lines were still there.

Comment 13 Pete Chown 2007-09-03 08:34:25 UTC
I agree with comment #9, this should be backed out, as it will be causing
ongoing problems for a lot of people.

What was the random delay trying to fix?  Unless it was an urgent thing, I can't
help wondering if it would have been better to wait until Fedora 8.  Even if the
update had worked, it would have changed the behaviour of everyone's machines
without them taking any active steps, and is that really what we want?

Comment 14 Pete Chown 2007-09-03 08:38:46 UTC
My apologies, I thought the delay was introduced by this update.  I get it now. :-)

Comment 15 Rick Mavrick 2007-09-04 03:46:06 UTC
It is also worth noting that the changes stop non-su users from using run-parts
as they do not have access to the /var/spool/anacron/* files by default.

Comment 16 Mike Chambers 2007-09-04 13:49:28 UTC
Sooo, after reading the comments, has a fix been released yet or going to be soon?

Comment 17 Gustavo Maciel Dias Vieira 2007-09-04 14:08:54 UTC
Same problem here, and probably everywhere.

I'm used to be very polite in bug reports (after all, you got to give some
credit to guys who are going to fix *your* problem). But, in this case, I will
open an exception. This is just ridiculous. This seemingly small change has very
big implications, and it is clear that the change wasn't well tough and was even
worse implemented. This should be reverted, and should be reverted now!


Comment 18 David Rees 2007-09-04 17:42:27 UTC
I agree, having a critical issue like this broken for 5 days now is completely
ridiculous.

Because of this issue, many of my systems missed processing many of their normal
cron.[daily|hourly|monthly] jobs.

What needs to be done to escalate this issue?

Comment 19 Norman Gaywood 2007-09-04 21:51:21 UTC
A new package to fix this has been built in koji. I went to:

http://koji.fedoraproject.org/koji/packageinfo?packageID=675

dowloaded crontabs-1.10-16.fc7 and did a:

yum localinstall crontabs-1.10-16.fc7

on all my systems. The changes in this package are an enhancement to the delay
feature and a revert of the anacron check thing that is causing this bug.

cron is now working for me as expected. I suspect this update will make it out
to updates eventually but as someone noted above, if you depend on cron to get
updates, you will have to do this step manually.



Comment 20 David Rees 2007-09-04 22:48:25 UTC
crontabs-1.10-16.fc7 has hit updates within the last hour.

Comment 21 Ian Mortimer 2007-09-05 01:52:45 UTC
A minor quibble about the new 000-delay.cron:

The variable name (DELAY) is misleading: reading it quickly an overworked
sysadmin might think it specified the length of delay (in some units).
DELAY_FACTOR would be more accurate.

In view of that, maybe setting DELAY=0 to turn off the delay should be allowed.
(Currently it will get a divide by zero error).  Something like:

--- 000-delay.cron.default      2007-09-05 11:37:19.000000000 +1000
+++ 000-delay.cron      2007-09-05 11:44:18.000000000 +1000
@@ -9,7 +9,7 @@
 # License: GPLv2
 
 [ -f /etc/sysconfig/crontab ] && . /etc/sysconfig/crontab
-if [ ! -z "$DELAY" ]; then
+if [[ -n $DELAY && $DELAY -ne 0 ]]; then
        # Create md5sum of hostname (static over system lifetime)
         md5sum="`echo ${HOSTNAME} | md5sum`"
 

--
Ian

Comment 22 s_h_o_ 2007-09-05 03:57:38 UTC
The problem has been fixed by the crontabs-1.10-16.fc7 in updates.
Thanks.


Comment 23 Marcela Mašláňová 2007-09-10 07:14:55 UTC
*** Bug 271501 has been marked as a duplicate of this bug. ***

Comment 24 Marcela Mašláňová 2007-09-10 15:10:23 UTC
*** Bug 276831 has been marked as a duplicate of this bug. ***