Subject: bin/10525: dump_lfs ignores lfs entries in /etc/fstab.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <minoura@flab.fujitsu.co.jp>
List: netbsd-bugs
Date: 07/06/2000 22:45:26
>Number:         10525
>Category:       bin
>Synopsis:       dump_lfs ignores lfs entries in /etc/fstab.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 06 22:46:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Minoura Makoto
>Release:        Branch netbsd-1-5 2000.07.02
>Organization:
	Japan NetBSD Users' Group (JNUG)
>Environment:
Fujitsu/PFU S-4/20H, HyperSPARC 150MHz
System: NetBSD soccer 1.5_ALPHA NetBSD 1.5_ALPHA (SOCCER) #27: Thu Jul 6 16:33:12 JST 2000 root@soccer:/usr/obj/sys/arch/sparc/compile/SOCCER sparc


>Description:
	dump_lfs skips the lfs entry in /etc/fstab.

>How-To-Repeat:
soccer# dump_lfs -0 -f test.dump /usr/obj
  DUMP: short read error from /usr/obj: [block 8192]: count=8192, got=0
  DUMP: short read error from /usr/obj: [sector 8192]: count=1, got=0
  DUMP: short read error from /usr/obj: [sector 8193]: count=1, got=0
  [SNIP]

>Fix:
	It will be great that we have a wrapper to read fstab and invoke
	dump_{ffs,lfs,ext2fs,msdos,...} just like fsck(8).
	A quick solution is following.

Index: dump/optr.c
===================================================================
RCS file: /proj/cvsroot/netbsd/src/sbin/dump/optr.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 optr.c
--- dump/optr.c	1998/04/01 16:15:40	1.1.1.1
+++ dump/optr.c	2000/07/07 04:28:46
@@ -449,9 +449,14 @@
 		    strcmp(fs->fs_type, FSTAB_RO) &&
 		    strcmp(fs->fs_type, FSTAB_RQ))
 			continue;
+#ifdef DUMP_LFS
+		if (strcmp(fs->fs_vfstype, "lfs"))
+			continue;
+#else
 		if (strcmp(fs->fs_vfstype, "ufs") &&
 		    strcmp(fs->fs_vfstype, "ffs"))
 			continue;
+#endif
 		fs = allocfsent(fs);
 		if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL)
 			quit("%s\n", strerror(errno));
Index: dump_lfs/Makefile
===================================================================
RCS file: /proj/cvsroot/netbsd/src/sbin/dump_lfs/Makefile,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile
--- dump_lfs/Makefile	1999/09/29 04:57:49	1.1.1.1
+++ dump_lfs/Makefile	2000/07/07 04:27:30
@@ -9,6 +9,7 @@
 PROG=	dump_lfs
 LINKS=	${BINDIR}/dump_lfs ${BINDIR}/rdump_lfs
 CPPFLAGS+=-DRDUMP -I${.CURDIR} -I${.CURDIR}/../dump
+CPPFLAGS+=-DDUMP_LFS
 # CPPFLAGS+= -DDEBUG -DTDEBUG -DFDEBUG -DWRITEDEBUG -DSTATS -DDIAGNOSTICS
 SRCS=	itime.c main.c optr.c dumprmt.c rcache.c tape.c traverse.c unctime.c \
 	ffs_bswap.c lfs_inode.c
>Release-Note:
>Audit-Trail:
>Unformatted: