From owner-freebsd-bugs Fri Oct 24 03:20:04 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id DAA07307 for bugs-outgoing; Fri, 24 Oct 1997 03:20:04 -0700 (PDT) (envelope-from owner-freebsd-bugs) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id DAA07297; Fri, 24 Oct 1997 03:20:02 -0700 (PDT) (envelope-from gnats) Date: Fri, 24 Oct 1997 03:20:02 -0700 (PDT) Message-Id: <199710241020.DAA07297@hub.freebsd.org> To: freebsd-bugs Cc: From: Bruce Evans Subject: Re: bin/4840: fsck dumps core when it can't read super block Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk The following reply was made to PR bin/4840; it has been noted by GNATS. From: Bruce Evans To: FreeBSD-gnats-submit@FreeBSD.ORG, pangolin@rogers.wave.ca Cc: Subject: Re: bin/4840: fsck dumps core when it can't read super block Date: Fri, 24 Oct 1997 20:16:11 +1000 >fsck in 3.0-CURRENT dumps core after dereferencing an unitialized >super block data structure. It seems the setup() routine now returns more >than a boolean. That is handled by a case statement with a suspicious >fall through. > >>How-To-Repeat: > ># ># as non-root ># >bash-2.01$ fsck >Can't open /dev/rwd1a: Permission denied >Segmentation fault (core dumped) It also dumps core for attempting to evaluate 0.0/0 when it gets a little further (e.g., for an empty partition). >>Fix: > >Possible patch. I do not know what the purpose of the fall through is. It is just to avoid repeating `return (0)' in the Lite2 version. It is just the result of a bad merge in the current version. >Exit code meaning is also unknown. Returning 1 may be better, but fsck seems to want to exit with status 0 after certain errors. For `fsck /dev/something', the change has no effect since fsck always exits with status 0 in that case. For `fsck' with no device args, returning 1 ensures that fsck exits with a nonzero status after checking all the file systems in /etc/fstab. Bruce