Subject: bin/2562: dump does the wrong thing with a null-mounted filesystem
To: None <gnats-bugs@NetBSD.ORG>
From: Grey Wolf <greywolf@starwolf.com>
List: netbsd-bugs
Date: 06/20/1996 16:19:21
>Number:         2562
>Category:       bin
>Synopsis:       dump does the wrong thing with a null-mounted filesystem
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 20 20:05:01 1996
>Last-Modified:
>Originator:     The Grey Wolf
>Organization:
Star Wolf Innovations
>Release:        1.2_ALPHA
>Environment:
	
	machine:	SPARCstation IPX
	os:		NetBSD 1.2_ALPHA 6/4/96
	target:		???
	libraries:	rebuild as of 6/1
System: NetBSD starjumper 1.2_ALPHA NetBSD 1.2_ALPHA (STARJUMPER) #10: Tue Jun 18 10:49:20 PDT 1996 greywolf@starjumper:/usr/src/sys/arch/sparc/compile/STARJUMPER sparc


>Description:
	If you try and dump a filesystem by name and something else is
	null mounted, dump will attempt to open the raw version of the
	null mounted-on point, rather than the special device.
>How-To-Repeat:
	Make an entry in /etc/fstab which nullmounts atop an existing file
	system, such as

	/dev/sd0h /disks/0h ffs rw 1 2
	/disks/0h /space    null rw 0 0
	
	# dump 0f /disks/0h
	DUMP: Date of this level 0 dump: Thu Jun 20 16:11:40 1996
	DUMP: Date of last level 0 dump: the epoch
	DUMP: Dumping /disks/r0h (/usr/src) to /dev/null
	DUMP: Cannot open /disks/r0h
	#
>Fix:
	The problem is that dump is prepared only to deal with ffs file-
	systems.  Until dump is built to handle different filesystem types,
	I think it's safe for dump to skip any fstab entries which are not
	of type "ffs".  Here's a patch to optr.c which causes any non-"ffs"
	entries to be ignored.

	It may be a band-aid, but it works.

*** optr.c	Thu Jun 20 15:55:55 1996
--- optr.c.orig	Thu Jun 20 15:56:46 1996
***************
*** 442,449 ****
  	while ((fs = getfsent()) != NULL) {
!  		if ((strcmp(fs->fs_type, FSTAB_RW) &&
  		    strcmp(fs->fs_type, FSTAB_RO) &&
! 		    strcmp(fs->fs_type, FSTAB_RQ)) ||
! 		    (strcmp(fs->fs_vfstype, "ffs")))
  			continue;
  		fs = allocfsent(fs);
  		if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL)
--- 442,448 ----
  	while ((fs = getfsent()) != NULL) {
!  		if (strcmp(fs->fs_type, FSTAB_RW) &&
  		    strcmp(fs->fs_type, FSTAB_RO) &&
! 		    strcmp(fs->fs_type, FSTAB_RQ))
  			continue;
  		fs = allocfsent(fs);
  		if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL)

	
>Audit-Trail:
>Unformatted: