Subject: bin/33457: [PATCH] dump_lfs: "-x" option cannot be used
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <ykomatsu@akaumigame.org>
List: netbsd-bugs
Date: 05/10/2006 16:00:00
>Number:         33457
>Category:       bin
>Synopsis:       [PATCH] dump_lfs: "-x" option cannot be used
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 10 16:00:00 +0000 2006
>Originator:     Yoshito Komatsu
>Release:        NetBSD 3.99.19
>Organization:
>Environment:
System: NetBSD c10.ln.akaumigame.org 3.99.19 NetBSD 3.99.19 (XENU) #0: Wed May 10 01:50:55 JST 2006 root@c8.ln.akaumigame.org:/usr/obj/sys/arch/i386/compile/XENU i386
Architecture: i386
Machine: i386
>Description:
	"-x" (snapshot) option cannot be used with dump_lfs.

	/dev/rxbd0a is mounted on /, but dump_lfs says
	that it is unmounted file system.

	DUMP: Found /dev/rxbd0a on / in /etc/fstab
	DUMP: WARNING: Cannot use -x or -X on unmounted file system.
	DUMP: Date of this level 0 dump: Wed May 10 14:51:55 2006
	DUMP: Date of last level 0 dump: the epoch
	DUMP: Dumping /dev/rxbd0a (/) to standard output
	DUMP: Label: none
	DUMP: mapping (Pass I) [regular files]
>How-To-Repeat:
	# dump_lfs -0an -x /var/snapshot -f /tmp/test.dump
>Fix:
	mntinfosearch() in sbin/dump/optr.c cannot understand
	lfs file system.

	I think the following patch fix this problem.

	# diff -uNr sbin/dump/optr.c.orig sbin/dump/optr.c
	--- sbin/dump/optr.c.orig	2006-05-10 23:51:31.000000000 +0900
	+++ sbin/dump/optr.c	2006-05-10 23:54:19.000000000 +0900
	@@ -427,9 +427,14 @@
		if ((mntbufc = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
			quit("Can't get mount list: %s", strerror(errno));
		for (fs = mntbuf, i = 0; i < mntbufc; i++, fs++) {
	+#ifdef DUMP_LFS
	+		if (strcmp(fs->f_fstypename, "lfs") != 0)
	+			continue;
	+#else
			if (strcmp(fs->f_fstypename, "ufs") != 0 &&
			    strcmp(fs->f_fstypename, "ffs") != 0)
				continue;
	+#endif
			if (strcmp(fs->f_mntonname, key) == 0 ||
			    strcmp(fs->f_mntfromname, key) == 0)
				return (fs);