Subject: bin/9282: restore does not print filesystems on dumps from null host
To: None <gnats-bugs@gnats.netbsd.org>
From: The Grey Wolf <greywolf@starwolf.com>
List: netbsd-bugs
Date: 01/23/2000 11:45:56
>Number:         9282
>Category:       bin
>Synopsis:       restore does not print filesystems on dumps from null host
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 23 11:45:00 2000
>Last-Modified:
>Originator:     Greywolf
>Organization:
Star Wolf Innovations
>Release:        1.4-current of 19 Jan 2000
>Environment:
	SPARCstation IPX
	NetBSD/sparc
	sparc
	[libs/userland of 9 Aug 1999]
	
System: NetBSD starwolf.com 1.4P NetBSD 1.4P (STARWOLF) #5: Sat Nov 20 13:38:32 PST 1999 greywolf@starwolf.com:/usr/src/sys/arch/sparc/compile/STARWOLF sparc

>Description:
	
	When restoring from a machine whose hostname was not set at the time
	of the dump, the "Level [lev] dump of [fs] on [host]:[device]"
	and volume label information do not get printed.  It is frustrating
	to wander through file after file on a tape to try and divine what
	lives where, especially during a full restore.  A dated df as the
	first file on the tape, i.e., "(date; df -kt ffs) | dd of=$TAPE bs=1k \
	conv=sync" makes navigation somewhat easier, but as mt fsf does not
	work quite right with an EXB-8200 tape drive (but that's
	can_of_worms_t *(*(*another[])())();), it is still difficult.

>How-To-Repeat:
	
	--Go to single user mode--

	# HOSTNAME=`hostname`
	# dump 0f - / | restore tvfh -; hostname ''; \
	dump 0f - / | restore tvfh -; hostname "$HOSTNAME"
	Verify tape and initialize maps
	Dump   date: Sun Jan 23 10:55:07 2000
	Dumped from: the epoch
	Level 0 dump of / on starwolf.com:/dev/sd3a
	Label: none
	Extract directories from tape
	Initialize symbol table.
	dir          2  .
	Verify tape and initialize maps
	Dump   date: Sun Jan 23 10:55:11 2000
	Dumped from: the epoch
	Extract directories from tape
	Initialize symbol table.
	dir          2  .

	Note that, in the second example (the one where hostname is unset),
	no hostname information is displayed.
	
>Fix:
	

--- /usr/src/sbin/restore/tape.c	Sun Jan 23 10:27:05 2000
+++ /usr/src/sbin/restore/tape.c.orig	Sun Jan  3 04:21:12 1999
@@ -508,9 +508,10 @@
 	fprintf(stdout, "Dump   date: %s", ctime(&spcl.c_date));
 	fprintf(stdout, "Dumped from: %s",
 	    (spcl.c_ddate == 0) ? "the epoch\n" : ctime(&spcl.c_ddate));
+	if (spcl.c_host[0] == '\0')
+		return;
 	fprintf(stderr, "Level %d dump of %s on %s:%s\n",
-		spcl.c_level, spcl.c_filesys, 
-		*spcl.c_host? spcl.c_host: "[unknown]", spcl.c_dev);
+		spcl.c_level, spcl.c_filesys, spcl.c_host, spcl.c_dev);
 	fprintf(stderr, "Label: %s\n", spcl.c_label);
 }
 
>Audit-Trail:
>Unformatted: