Gentoo Archives: gentoo-dev

From: Jason Rhinelander <jason@××××××××××××××××.com>
To: Mike Lincoln <mclinc@××××××××.uk>
Cc: gentoo-dev@g.o
Subject: Re: [gentoo-dev] checkfs oddities
Date: Thu, 13 Nov 2003 20:13:17
Message-Id: 3FB3E5B8.2070706@gossamer-threads.com
In Reply to: [gentoo-dev] checkfs oddities by Mike Lincoln
1 Mike Lincoln wrote:
2 > Hello all,
3 > I believe I have found (and fixed) a trivial bug in checkfs, but that's
4 > not the reason for this email. I was about to file it with bugzilla and
5 > I found something quite strange.
6 >
7 > First off the bug:
8 >
9 > /etc/init.d/checkfs v1.29 incorrectly tests the return code from fsck
10 > at line 201.
11 >
12 >
13 >>elif [ "${retval}" -gt 1 -a "${retval}" -lt 4 ]
14 >> then
15 >> ewend 1 "Filesystem errors corrected."
16 >> # Everything should be ok, so return a pass
17 >> return 0
18 >> else
19 >
20 >
21 > Should, IMHO, read:
22 >
23 >
24 >>elif [ "${retval}" -ge 1 -a "${retval}" -lt 4 ]
25 >> then
26 >> ewend 1 "Filesystem errors corrected."
27 >> # Everything should be ok, so return a pass
28 >> return 0
29 >> else
30 >
31 >
32 > Note the -gt goes to -ge because fsck returns 1 on corrected errors.
33 > BTW. I discovered this with a jfs root file system. This is because
34 > fsck.jfs alway seems to return 1 when it replays the log. I guess
35 > that's a feature looking at the man page.
36
37 From man fsck, the exit codes of fsck are as follows:
38
39 0 - No errors
40 1 - File system errors corrected
41 2 - System should be rebooted
42 4 - File system errors left uncorrected
43 8 - Operational error
44 16 - Usage or syntax error
45 32 - Fsck canceled by user request
46 128 - Shared library error
47
48 From that, it seems that 0, 1, and possibly 2 and 32 are acceptable,
49 but to make the acceptable values clearer (and easier if 32 is allowed)
50 we might consider changing the elif to:
51
52 elif [ $((retval & ~(0|1|2|32))) -eq 0 ]
53
54 That more clearly indicates that 0, 1, and 2 (or combinations thereof)
55 are accepted values, but anything else is not. It also allows us to
56 add, for example, 32, which IMHO seems like it should be allowed as
57 well. Yes, it isn't known that the filesystem is okay, but if I user
58 really wants to cancel it, they can. Additionally, 64 is currently not
59 defined - if it became something like "non-critical filesystem errors
60 left uncorrected", it'd be trivial to add.
61
62 > Now for the odditie: I have two gentoo boxes, both have recently run
63 > "emerge sync && emerge baselayout". I've double checked and both boxes
64 > have the same version of baselayout. /However/, they have different
65 > versions of checkfs! I've reemerged baselayout on both machines, but
66 > they still have different versions of checkfs 1.23 and 1.29.
67
68 At a guess, I'd say the updated files are pending due to config
69 protection, and you haven't merged them yet with etc-update?
70
71 --
72 -- Jason Rhinelander
73 -- Gossamer Threads, Inc.
74
75
76 --
77 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] checkfs oddities Mike Lincoln <mclinc@××××××××.uk>