Subject: bin/3203: config make wild assumptions about swap/dumps
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ivanenko@ctpa03.mit.edu>
List: netbsd-bugs
Date: 02/09/1997 13:45:17
>Number:         3203
>Category:       bin
>Synopsis:       config make wild assumptions about swap/dumps
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb  9 10:50:00 1997
>Last-Modified:
>Originator:     Taras Ivanenko
>Organization:
	
>Release:        <NetBSD-current source date> Feb 8, 1997
>Environment:
	
System: NetBSD taras.mit.edu 1.2A NetBSD 1.2A (TARAS) #19: Mon Oct 21 22:00:22 EDT 1996 ivanenko@taras.mit.edu:/usr/src/sys/arch/mac68k/compile/TARAS mac68k


>Description:
	
I used to have the root/swap specified in my config files. So, when rebuilding
 the kernel I decided not to rely on autoconfig and specify the root and swap 
in the same file:

config netbsd root on sd1a

Here is the output from config in swapnetbsd.c:
#include <sys/param.h>
#include <sys/conf.h>

const char *rootspec = "sd1a";
dev_t	rootdev = makedev(4, 8);	/* sd1a */
dev_t	dumpdev = makedev(4, 2);	/* sd0c */

struct	swdevt swdevt[] = {
	{ makedev(4, 2),	0,	0 },	/* sd0c */
	{ NODEV, 0, 0 }
};

int (*mountroot) __P((void)) = NULL;

So, on any attempt to boot my sd0 disk will be wiped out (sd0c == the whole
disk). If I specify swap in addition root, dumpdev is still sd0 and my disk
will be corrupted when the system crash. Only if root is sd0 swap and dumps
go correctly to sd0b. Shall I say that sd0 has nothing to do with NetBSD, it
has MacOS stuff, but I will not be able to boot NetBSD without it?

I am also wondering what autoconfig assumes about swap/dumps if root is not
specified (like in GENERIC configuration)

>How-To-Repeat:
	
See above.
>Fix:
	<how to correct or work around the problem, if known (multiple
lines)> What is the desired behaviour? If at some unspecified date in the
future I will be able to add swap and dumps devices without specifying
anything in the kernel configuration, config must not accept those
keywords. As an alternative it may require complete specification
(root+swap+dumps) if any of those is to be detailed. At least config could
leave swapdev and dumpsdev undefined, not set them to the real device. For
a moment I think about making backup of sd0 and leaving the configuration
question to NetBSD core to decide.



>Audit-Trail:
>Unformatted:
  config substitutes sd0 for swap and dumps when the root is specified
  serious
  medium
	sw-bug