Bug 164872 - Reversed logic in readahead script
Summary: Reversed logic in readahead script
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: readahead
Version: 4
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karel Zak
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-08-02 03:44 UTC by Doug Mitchell
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-06-29 08:45:31 UTC
Type: ---
Embargoed:


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

Description Doug Mitchell 2005-08-02 03:44:03 UTC
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):
readahead-1.1-1.14

How reproducible:
Always

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-03 00:01:35 UTC
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-03 00:19:42 UTC
Yeah, looks right.

Comment 3 John Robinson 2005-08-04 01:43:55 UTC
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 04:54:00 UTC
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 07:04:09 UTC
readahead_early still has the same problem. 

Comment 6 Ville Skyttä 2005-08-04 07:08:14 UTC
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 17:29:47 UTC
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.