Bug 447647

Summary: freshclam-sleep is needlessly complex
Product: [Fedora] Fedora Reporter: Gordon Messmer <gordon.messmer>
Component: clamavAssignee: Enrico Scholz <rh-bugzilla>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 9CC: steve
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-21 07:13:22 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 Gordon Messmer 2008-05-20 22:33:24 UTC
Description of problem:
This line appears in freshclam-sleep, a Fedora script:
	sleep $[ (FRESHCLAM_DELAY % FRESHCLAM_MOD + FRESHCLAM_MOD) % FRESHCLAM_MOD ]

This line is equivalent, and is easier to read:

	sleep $[ FRESHCLAM_DELAY % FRESHCLAM_MOD ]

Additionally, since cron executes jobs in parallel, there's no reason to have
FRESHCLAM_MOD in any of the files.  It could be removed from sysconfig/freshclam
and freshclam-sleep entirely with no detrimental effects.  Users might notice
that there are multiple freshclam-sleep jobs sleeping at any given time, but
that won't cause any problems, and simplifies configuration.  As it is, users
may still see that if they adjust the cron schedule and not FRESHCLAM_MOD.

Comment 1 Enrico Scholz 2008-05-21 07:13:22 UTC
Won't change it.  Mentioned line is due to

| $ d=-5
| $ m=10
| $ echo $[ d % m ]
| -5
| $ echo $[ (d % m + m) % m ]
| 5

FRESHCLAM_MOD must stay as FRESHCLAM_DELAY is calculated from 'hostid' which
returns a 32 bit number.