* [gentoo-dev] checkfs oddities
@ 2003-11-13 14:02 Mike Lincoln
2003-11-13 20:12 ` Jason Rhinelander
0 siblings, 1 reply; 3+ messages in thread
From: Mike Lincoln @ 2003-11-13 14:02 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2890 bytes --]
Hello all,
I believe I have found (and fixed) a trivial bug in checkfs, but that's
not the reason for this email. I was about to file it with bugzilla and
I found something quite strange.
First off the bug:
/etc/init.d/checkfs v1.29 incorrectly tests the return code from fsck
at line 201.
>elif [ "${retval}" -gt 1 -a "${retval}" -lt 4 ]
> then
> ewend 1 "Filesystem errors corrected."
> # Everything should be ok, so return a pass
> return 0
> else
Should, IMHO, read:
>elif [ "${retval}" -ge 1 -a "${retval}" -lt 4 ]
> then
> ewend 1 "Filesystem errors corrected."
> # Everything should be ok, so return a pass
> return 0
> else
Note the -gt goes to -ge because fsck returns 1 on corrected errors.
BTW. I discovered this with a jfs root file system. This is because
fsck.jfs alway seems to return 1 when it replays the log. I guess
that's a feature looking at the man page.
Now for the odditie: I have two gentoo boxes, both have recently run
"emerge sync && emerge baselayout". I've double checked and both boxes
have the same version of baselayout. /However/, they have different
versions of checkfs! I've reemerged baselayout on both machines, but
they still have different versions of checkfs 1.23 and 1.29.
Proof is bellow, can anyone shed any light on this?
I'm a bit of a Gentoo newbie I'm afraid, so sorry if I'm being brain
damaged here. If there is anything I can do to assist, just ask.
Best regards,
Mike
--------------
Box A:
# etcat -b /etc/init.d/checkfs
Searching for /etc/init.d/checkfs in * ...
sys-apps/baselayout-1.8.6.10-r1
# etcat -v baselayout
[ Results for search key : baselayout ]
[ Applications found : 1 ]
* sys-apps/baselayout :
[ ] sys-apps/baselayout-1.8.5.9 (0)
[ ] sys-apps/baselayout-1.8.6.8-r1 (0)
[ I] sys-apps/baselayout-1.8.6.10-r1 (0)
[M~ ] sys-apps/baselayout-1.8.6.11 (0)
[M~ ] sys-apps/baselayout-1.8.6.12 (0)
# grep Header /etc/init.d/checkfs
# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/checkfs,v 1.23
2003/03/24 15:25:05 azarah Exp $
--------
Box B
# etcat -b /etc/init.d/checkfs
Searching for /etc/init.d/checkfs in * ...
sys-apps/baselayout-1.8.6.10-r1
# etcat -v baselayout
[ Results for search key : baselayout ]
[ Applications found : 1 ]
* sys-apps/baselayout :
[ ] sys-apps/baselayout-1.8.5.9 (0)
[ ] sys-apps/baselayout-1.8.6.8-r1 (0)
[ I] sys-apps/baselayout-1.8.6.10-r1 (0)
[M~ ] sys-apps/baselayout-1.8.6.11 (0)
[M~ ] sys-apps/baselayout-1.8.6.12 (0)
# grep Header /etc/init.d/checkfs
# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/checkfs,v 1.29
2003/08/04 19:41:15 azarah Exp $
--
Dr. Michael C Lincoln
Vision And Synthetic Environments
University of Essex
OFFICE: 01206 87 3708
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] checkfs oddities
2003-11-13 14:02 [gentoo-dev] checkfs oddities Mike Lincoln
@ 2003-11-13 20:12 ` Jason Rhinelander
2003-11-14 13:34 ` Mike Lincoln
0 siblings, 1 reply; 3+ messages in thread
From: Jason Rhinelander @ 2003-11-13 20:12 UTC (permalink / raw
To: Mike Lincoln; +Cc: gentoo-dev
Mike Lincoln wrote:
> Hello all,
> I believe I have found (and fixed) a trivial bug in checkfs, but that's
> not the reason for this email. I was about to file it with bugzilla and
> I found something quite strange.
>
> First off the bug:
>
> /etc/init.d/checkfs v1.29 incorrectly tests the return code from fsck
> at line 201.
>
>
>>elif [ "${retval}" -gt 1 -a "${retval}" -lt 4 ]
>> then
>> ewend 1 "Filesystem errors corrected."
>> # Everything should be ok, so return a pass
>> return 0
>> else
>
>
> Should, IMHO, read:
>
>
>>elif [ "${retval}" -ge 1 -a "${retval}" -lt 4 ]
>> then
>> ewend 1 "Filesystem errors corrected."
>> # Everything should be ok, so return a pass
>> return 0
>> else
>
>
> Note the -gt goes to -ge because fsck returns 1 on corrected errors.
> BTW. I discovered this with a jfs root file system. This is because
> fsck.jfs alway seems to return 1 when it replays the log. I guess
> that's a feature looking at the man page.
From man fsck, the exit codes of fsck are as follows:
0 - No errors
1 - File system errors corrected
2 - System should be rebooted
4 - File system errors left uncorrected
8 - Operational error
16 - Usage or syntax error
32 - Fsck canceled by user request
128 - Shared library error
From that, it seems that 0, 1, and possibly 2 and 32 are acceptable,
but to make the acceptable values clearer (and easier if 32 is allowed)
we might consider changing the elif to:
elif [ $((retval & ~(0|1|2|32))) -eq 0 ]
That more clearly indicates that 0, 1, and 2 (or combinations thereof)
are accepted values, but anything else is not. It also allows us to
add, for example, 32, which IMHO seems like it should be allowed as
well. Yes, it isn't known that the filesystem is okay, but if I user
really wants to cancel it, they can. Additionally, 64 is currently not
defined - if it became something like "non-critical filesystem errors
left uncorrected", it'd be trivial to add.
> Now for the odditie: I have two gentoo boxes, both have recently run
> "emerge sync && emerge baselayout". I've double checked and both boxes
> have the same version of baselayout. /However/, they have different
> versions of checkfs! I've reemerged baselayout on both machines, but
> they still have different versions of checkfs 1.23 and 1.29.
At a guess, I'd say the updated files are pending due to config
protection, and you haven't merged them yet with etc-update?
--
-- Jason Rhinelander
-- Gossamer Threads, Inc.
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] checkfs oddities
2003-11-13 20:12 ` Jason Rhinelander
@ 2003-11-14 13:34 ` Mike Lincoln
0 siblings, 0 replies; 3+ messages in thread
From: Mike Lincoln @ 2003-11-14 13:34 UTC (permalink / raw
To: Jason Rhinelander; +Cc: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2641 bytes --]
On Thu, 2003-11-13 at 20:12, Jason Rhinelander wrote:
Snip...
> From man fsck, the exit codes of fsck are as follows:
>
> 0 - No errors
> 1 - File system errors corrected
> 2 - System should be rebooted
> 4 - File system errors left uncorrected
> 8 - Operational error
> 16 - Usage or syntax error
> 32 - Fsck canceled by user request
> 128 - Shared library error
>
> From that, it seems that 0, 1, and possibly 2 and 32 are acceptable,
> but to make the acceptable values clearer (and easier if 32 is allowed)
> we might consider changing the elif to:
>
> elif [ $((retval & ~(0|1|2|32))) -eq 0 ]
>
> That more clearly indicates that 0, 1, and 2 (or combinations thereof)
> are accepted values, but anything else is not. It also allows us to
> add, for example, 32, which IMHO seems like it should be allowed as
> well. Yes, it isn't known that the filesystem is okay, but if I user
> really wants to cancel it, they can. Additionally, 64 is currently not
> defined - if it became something like "non-critical filesystem errors
> left uncorrected", it'd be trivial to add.
>
Agreed except for return code 2. If the "System should be rebooted",
then surely it shouldn't continue booting.
I would argue that fsck.jfs shouldn't return code 2 after a journal log
replay as that is a normal function, not an error.
> > Now for the odditie: I have two gentoo boxes, both have recently run
> > "emerge sync && emerge baselayout". I've double checked and both boxes
> > have the same version of baselayout. /However/, they have different
> > versions of checkfs! I've reemerged baselayout on both machines, but
> > they still have different versions of checkfs 1.23 and 1.29.
>
> At a guess, I'd say the updated files are pending due to config
> protection, and you haven't merged them yet with etc-update?
Nope, on both systems etc-update returns:
Scanning Configuration files...
Exiting: Nothing left to do; exiting. :)
If I get time later, I'll delete the offending file and re-emerge
baselayout again to see what happens. If that doesn't get me the same
version of checkfs on both systems, and given my limited knowledge of
portage, I'm left wondering if there are two versions of
baselayout-1.8.6.10-r1 kicking around on different mirrors (!).
~
Mike
>
> --
> -- Jason Rhinelander
> -- Gossamer Threads, Inc.
--
Dr. Michael C Lincoln
Vision And Synthetic Environments
University of Essex
OFFICE: 01206 87 3708
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-11-14 13:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-13 14:02 [gentoo-dev] checkfs oddities Mike Lincoln
2003-11-13 20:12 ` Jason Rhinelander
2003-11-14 13:34 ` Mike Lincoln
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox