Bug 164872 - Reversed logic in readahead script
Reversed logic in readahead script
Product: Fedora
Classification: Fedora
Component: readahead (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Karel Zak
Depends On:
  Show dependency treegraph
Reported: 2005-08-01 23:44 EDT by Doug Mitchell
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-06-29 04:45:31 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Suggested improvements (29.52 KB, patch)
2005-08-04 03:08 EDT, Ville Skyttä
no flags Details | Diff

  None (edit)
Description Doug Mitchell 2005-08-01 23:44:03 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050720 Fedora/1.0.6-1.1.fc4 Firefox/1.0.6

Description of problem:

The script /etc/rc.d/init.d/readahead checks to see if there is at least 384M of RAM before running.  The logic is reversed, so it runs if there is LESS THAN 384M of RAM.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.  Do "service readahead start" on a box with 1G of RAM.
2.  Watch it not start or do anything.


Actual Results:  
readahead did not run

Expected Results:  
readahead should have run

Additional info:

The line
free -m | awk '/Mem:/ {exit ($2 < 384)?0:1}' || exit 0
is incorrect.

If total RAM <  384, the awk returns 0, so readahead runs
If total RAM >= 384, the awk returns 1, so the exit runs

Please be kind if I have this backwards.
Comment 1 Dave Jones 2005-08-02 20:01:35 EDT
looks ok to me. committed, and built for next errata.
Bill, want to double check that logic ? as I think it was you that created this
script ?
Comment 2 Bill Nottingham 2005-08-02 20:19:42 EDT
Yeah, looks right.
Comment 3 John Robinson 2005-08-03 21:43:55 EDT
Did nobody notice that this package didn't work? I mean, completely and utterly
failed to do what it was created to do? If so, how did this happen?
Comment 4 Dave Jones 2005-08-04 00:54:00 EDT
beats me. I guess the fact that it always printed [ OK ] worked as a placebo
even when it didn't actually do anything.  I'm as surprised as the next guy that
it took this long for someone to notice.  I recall seeing timings of the new
code vs the old code at some point, I guess the script got subsequently changed,
and not retested.
Comment 5 Ville Skyttä 2005-08-04 03:04:09 EDT
readahead_early still has the same problem. 
Comment 6 Ville Skyttä 2005-08-04 03:08:14 EDT
Created attachment 117432 [details]
Suggested improvements

Here's a patch containing the fix and some while-at-it-improvements for review:

- readahead_early looks useful in more runlevels than just 5.
- Sync versioned gcc, firefox and openoffice.org dirs with FC4 updates.
Comment 7 Dave Jones 2005-08-04 13:29:47 EDT
argh. Thanks Ville, I've merged these into CVS for FC4/rawhide.
I'll do another errata soon.

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