Module Name:    src
Committed By:   dholland
Date:           Sat Jul 12 16:11:27 UTC 2014

Modified Files:
        src/distrib/utils/sysinst: disks.c
        src/sbin/fsck_lfs: fsck_lfs.8 main.c

Log Message:
Revert version 1.111 of sysinst/disks.c, which caused sysinst to
create lfs fstab entries with fsck disabled, and instead patch
fsck_lfs to exit successfully without doing anything when given the -p
(bootup preen) option. If you really want to do fsck_lfs -p, you can
do fsck_lfs -f -p to make it go.

This has been sitting in my todo queue since February 2010 and was
ok'd by the committer at the time. The original commit was based on
this post:
   http://mail-index.netbsd.org/tech-kern/2010/02/09/msg007306.html

and I remain unconvinced that it's the right thing, but we can at
least do it properly and not ship a sysinst with -7 that creates
permanently wrong fstab files.

Note that this may cause problems for anyone who's taken -p out of the
bootup fsck flags; but doing that is wrong, so don't.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/distrib/utils/sysinst/disks.c
cvs rdiff -u -r1.24 -r1.25 src/sbin/fsck_lfs/fsck_lfs.8
cvs rdiff -u -r1.45 -r1.46 src/sbin/fsck_lfs/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/sysinst/disks.c
diff -u src/distrib/utils/sysinst/disks.c:1.130 src/distrib/utils/sysinst/disks.c:1.131
--- src/distrib/utils/sysinst/disks.c:1.130	Sat Dec  7 20:40:42 2013
+++ src/distrib/utils/sysinst/disks.c	Sat Jul 12 16:11:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.130 2013/12/07 20:40:42 martin Exp $ */
+/*	$NetBSD: disks.c,v 1.131 2014/07/12 16:11:27 dholland Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -772,10 +772,7 @@ make_fstab(void)
 			if (!check_lfs_progs())
 				s = "# ";
 			fstype = "lfs";
-			/* XXX fsck_lfs considered harmfull */
-			fsck_pass = 0;
-			dump_freq = 1;
-			break;
+			/* FALLTHROUGH */
 		case FS_BSDFFS:
 			fsck_pass = (strcmp(mp, "/") == 0) ? 1 : 2;
 			dump_freq = 1;

Index: src/sbin/fsck_lfs/fsck_lfs.8
diff -u src/sbin/fsck_lfs/fsck_lfs.8:1.24 src/sbin/fsck_lfs/fsck_lfs.8:1.25
--- src/sbin/fsck_lfs/fsck_lfs.8:1.24	Tue Mar 18 18:20:38 2014
+++ src/sbin/fsck_lfs/fsck_lfs.8	Sat Jul 12 16:11:27 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: fsck_lfs.8,v 1.24 2014/03/18 18:20:38 riastradh Exp $
+.\"	$NetBSD: fsck_lfs.8,v 1.25 2014/07/12 16:11:27 dholland Exp $
 .\"
 .\" Copyright (c) 1980, 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)fsck.8	8.3 (Berkeley) 11/29/94
 .\"
-.Dd October 9, 2008
+.Dd July 12, 2014
 .Dt FSCK_LFS 8
 .Os
 .Sh NAME
@@ -134,7 +134,8 @@ Specify
 mode.
 Currently, in this mode
 .Nm
-rolls forward from the older checkpoint, and performs no other action.
+does nothing.
+.\" rolls forward from the older checkpoint, and performs no other action.
 .It Fl q
 Quiet mode, do not output any messages for clean filesystems.
 .It Fl U

Index: src/sbin/fsck_lfs/main.c
diff -u src/sbin/fsck_lfs/main.c:1.45 src/sbin/fsck_lfs/main.c:1.46
--- src/sbin/fsck_lfs/main.c:1.45	Sat Jun  8 02:16:03 2013
+++ src/sbin/fsck_lfs/main.c	Sat Jul 12 16:11:27 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.45 2013/06/08 02:16:03 dholland Exp $	 */
+/* $NetBSD: main.c,v 1.46 2014/07/12 16:11:27 dholland Exp $	 */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -35,6 +35,7 @@
 #include <ufs/lfs/lfs.h>
 
 #include <fstab.h>
+#include <stdbool.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
@@ -73,7 +74,9 @@ main(int argc, char **argv)
 	int ch;
 	int ret = FSCK_EXIT_OK;
 	const char *optstring = "b:dfi:m:npPqUy";
+	bool reallypreen;
 
+	reallypreen = false;
 	ckfinish = ckfini;
 	skipclean = 1;
 	exitonfail = 0;
@@ -95,6 +98,7 @@ main(int argc, char **argv)
 			break;
 		case 'f':
 			skipclean = 0;
+			reallypreen = true;
 			break;
 		case 'i':
 			idaddr = strtol(optarg, NULL, 0);
@@ -142,6 +146,29 @@ main(int argc, char **argv)
 	if (!argc)
 		usage();
 
+	/*
+	 * Don't do anything in preen mode. This is a replacement for
+	 * version 1.111 of src/distrib/utils/sysinst/disks.c, which
+	 * disabled fsck on installer-generated lfs partitions. That
+	 * isn't the right way to do it; better to run fsck but have
+	 * it not do anything, so that when the issues in fsck get
+	 * resolved it can be turned back on.
+	 *
+	 * If you really want to run fsck in preen mode you can do:
+	 *    fsck_lfs -p -f image
+	 *
+	 * This was prompted by
+	 * http://mail-index.netbsd.org/tech-kern/2010/02/09/msg007306.html.
+	 *
+	 * It would be nice if someone prepared a more detailed report
+	 * of the problems.
+	 *
+	 * XXX.
+	 */
+	if (preen && !reallypreen) {
+		return ret;
+	}
+
 	if (signal(SIGINT, SIG_IGN) != SIG_IGN)
 		(void) signal(SIGINT, catch);
 	if (preen)

Reply via email to