bin/27687: fsck(8) wrapper is not properly passing options to fsck_<fstype>

Bruce Evans brde at optusnet.com.au
Sat Sep 25 03:13:06 UTC 2010


On Fri, 24 Sep 2010 brucec at freebsd.org wrote:

> Synopsis: fsck(8) wrapper is not properly passing options to fsck_<fstype>
>
> Responsible-Changed-From-To: freebsd-bugs->freebsd-fs
> Responsible-Changed-By: brucec
> Responsible-Changed-When: Fri Sep 24 20:52:17 UTC 2010
> Responsible-Changed-Why:
> Over to maintainer(s).
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=27687

In fact, the description of the problem already shows that it isn't a problem:

% >Description:
% 
% 	If one boots single user and then does
% 		fsck -b 32 /foo
% 	fsck reports:
% 		fsck: illegal option -- b
% 		Usage: fsck [-BFdpvlyn] [-T fstype:fsoptions] [-t fstype] [special|node]...
% 	one must use fsck_ffs directly even though fsck should have every
% 	thing it needs from /etc/fstab to DTRT.

As fsck reports, it has a -T option for passing options.  -Tufs:-b32 seems
to work right.

The man page says more about this, but doesn't say what happens with multiple
-T or -t options.  I think they are concatenated at the fsck level, with the
order preserved, and then filtered when passed.  So
"-T ufs:-b16,-y -Tmsdosfs:-n -Tufs:-b32,-n" passes "-b16 -y -b32 -n" to
fsck_ffs and "-n" to fsck_msdosfs.  The effect of multiple options is
also undocumented in fsck_ffs.  In practice, the last one usually has
precedence, but "-b16 -b32 -b64" causes fsck_ffs to print that it uses
3 alternates (sic) although it actually only uses 1 alternative (sic)
(the last one).  Multiple alternatives are especially useless and
dangerous for -b (especially with multiple special files), but I used
them in these examples and testing because they are good for generating
messages for both errors and success.

Bruce


More information about the freebsd-bugs mailing list