|
Bugzilla – Full Text Bug Listing |
| Summary: | bug in cron.daily evaluation routine | ||
|---|---|---|---|
| Product: | [openSUSE] openSUSE 10.2 | Reporter: | Thomas Blume <thomas.blume> |
| Component: | Other | Assignee: | Matthias Koenig <mkoenig> |
| Status: | RESOLVED FIXED | QA Contact: | E-mail List <qa-bugs> |
| Severity: | Normal | ||
| Priority: | P5 - None | CC: | caustin, ml-itshh |
| Version: | Final | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | SUSE Other | ||
| Whiteboard: | |||
| Found By: | Customer | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
Fixed in stable. Do we want this for 10.2? *** Bug 283218 has been marked as a duplicate of this bug. *** *** Bug 419636 has been marked as a duplicate of this bug. *** |
Customer has set the variable DAILY_TIME="00:15" in /etc/sysconfig/cron. According to the documentation this should execute cron.daily at 00:15. But the customer noticed that now cron daily was run twice, on 00:00 and 00:15. Investigating this he found a bug in: /usr/lib/cron/run-crons. The row: DAILY_TIME_NEW="`echo $DAILY_TIME | sed s,:,, | sed s,^0,, `" will remove the colon and the first zero from the value in DAILY_TIME and hence put 015 into DAILY_TIME_NEW. This is then evaluated in: [ $(($DAILY_TIME_NEW - 15)) -lt "$NOW_H" ] && [ $(($DAILY_TIME_NEW + 15)) -gt "$NOW_H" ] According to the bash manpage (ARITHMETIC EVALUATION): Constants with a leading 0 are interpreted as octal numbers. Hence 015 is evaluated octal which gives 5 times 8 power of 0 plus 1 time 8 power of 1 equals 5+8=13. For 13, the comparison above is true for both NOW_H=0 and NOW_H=15. I guess it is not intended that the value in DAILY_TIME gets evaluated octal. A fix therefore is simple. Just remove all leading zeroes from DAILY_TIME in order to let it evaluate decimal, e.g.: DAILY_TIME_NEW="`echo $DAILY_TIME | sed s,:,, | sed s,^0*,, `"