Subject: bin/5346: dump crashes after writing dumpdates.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <haszlaki@UAccess.NET>
List: netbsd-bugs
Date: 04/22/1998 01:34:57
>Number:         5346
>Category:       bin
>Synopsis:       dump crashes w/ SIGSEGV after writing dumpdates.
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 21 23:50:01 1998
>Last-Modified:
>Originator:     Eric Haszlakiewicz
>Organization:
>Release:        <NetBSD-current source date>
>Environment:
System: NetBSD guinness 1.3E NetBSD 1.3E (GUINNESS) #0: Thu Apr 16 03:21:55 CDT 1998 root@guinness:/tmp/GUINNESS i386

>Description:
	When dump finishes dumping it writes stuff back to dumpdates
including the time.  This works fine, but then it tries to spit out
visibly the time after clearing the variable which points to it when
looping over each dumpdates line to write them back to the file, which
doesn't.
(bug introduced during endian-independant FFS changes)
(rev 1.6, 1.7 of itime.c have this bug)
>How-To-Repeat:
	dump <blah>
>Fix:
patch:

--- itime.old	Wed Apr 22 01:32:33 1998
+++ itime.c	Wed Apr 22 01:31:29 1998
@@ -174,7 +174,7 @@
 putdumptime()
 {
 	FILE *df;
-	struct dumpdates *dtwalk;
+	struct dumpdates *dtwalk, *dtfound;
 	int i;
 	int fd;
 	char *fname;
@@ -214,6 +214,7 @@
 	(void) strncpy(dtwalk->dd_name, fname, sizeof (dtwalk->dd_name));
 	dtwalk->dd_level = level;
 	dtwalk->dd_ddate = iswap32(spcl.c_date);
+	dtfound = dtwalk;
 
 	ITITERATE(i, dtwalk) {
 		dumprecout(df, dtwalk);
@@ -224,7 +225,7 @@
 		quit("ftruncate (%s): %s\n", dumpdates, strerror(errno));
 	(void) fclose(df);
 	msg("level %c dump on %s", level,
-		spcl.c_date == 0 ? "the epoch\n" : ctime(&dtwalk->dd_ddate));
+		spcl.c_date == 0 ? "the epoch\n" : ctime(&dtfound->dd_ddate));
 }
 
 static void
>Audit-Trail:
>Unformatted: