NetBSD Problem Report #42952

From greywolf@starwolf.com  Wed Mar 10 23:33:23 2010
Return-Path: <greywolf@starwolf.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 9BEF363B873
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 10 Mar 2010 23:33:23 +0000 (UTC)
Message-Id: <201003102333.o2ANXMVh013536@lothlorien.starwolf.com>
Date: Wed, 10 Mar 2010 15:33:22 -0800 (PST)
From: greywolf@starwolf.com
Reply-To: greywolf@starwolf.com
To: gnats-bugs@gnats.NetBSD.org
Subject: Fix to dump(8)'s "true incremental"
X-Send-Pr-Version: 3.95

>Number:         42952
>Category:       bin
>Synopsis:       Fix to dump(8)'s "true incremental"
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 10 23:35:00 +0000 2010
>Closed-Date:    Mon Oct 25 02:12:20 +0000 2010
>Last-Modified:  Mon Oct 25 02:12:20 +0000 2010
>Originator:     The Grey Wolf
>Release:        NetBSD 5.0_RC1 [sources -current]
>Organization:

				--*greywolf;
--
>Environment:
System: NetBSD lothlorien.starwolf.com 5.0_RC1 NetBSD 5.0_RC1 (GENERIC) #0: Wed Jan 28 10:59:04 PST 2009 builds@wb25:/home/builds/ab/netbsd-5/i386/200901280002Z-obj/home/builds/ab/netbsd-5/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	Dave Holland brought to my attention that a "true incremental dump"
	is not a level 9 in any sense of the word.  I have modified the code
	such that levels 0 thru 9 are preserved in their sanctity, and an
	incremental dump is registered as an 'i'.  This complicated things
	because the restore showed the dump as a "level 57".  I added a
	conditional that set spcl.c_level to 10 if (level > '9').

	Further, I discovered that the code that tests for "true incremental"
	had a second conditional test that turns out to be superfluous,
	so I simplified by removing this.
>How-To-Repeat:
>Fix:
--- main.c.orig	2010-03-10 14:19:06.000000000 -0800
+++ main.c	2010-03-10 14:37:44.000000000 -0800
@@ -181,8 +181,8 @@
 			honorlevel = numarg("honor level", 0L, 10L);
 			break;

-		case 'i':	/* "true incremental" regardless level 9 */
-			level = '9';
+		case 'i':	/* "true incremental" regardless level */
+			level = 'i';
 			trueinc = 1;
 			break;

@@ -470,7 +470,8 @@

 	needswap = fs_read_sblock(sblock_buf);

-	spcl.c_level = iswap32(level - '0');
+	/* true incremental is always a level 10 dump */
+	spcl.c_level = trueinc? iswap32(10): iswap32(level - '0');
 	spcl.c_type = iswap32(TS_TAPE);
 	spcl.c_date = iswap32(spcl.c_date);
 	spcl.c_ddate = iswap32(spcl.c_ddate);

--- itime.c.orig	2010-03-10 14:19:12.000000000 -0800
+++ itime.c	2010-03-10 14:30:39.000000000 -0800
@@ -146,13 +146,18 @@
 	/*
 	 *	Go find the entry with the same name for a lower increment
 	 *	and older date.  If we are doing a true incremental, then
-	 *	we can use level 9 as a ref point
+	 *	we can use any level as a ref point.
 	 */
 	ITITERATE(i, ddp) {
 		if (strncmp(fname, ddp->dd_name, sizeof (ddp->dd_name)) != 0)
 			continue;
-		if ((!trueinc && (ddp->dd_level >= level)) ||
-		    (trueinc && (ddp->dd_level > level)))
+		/* trueinc: ostensibly could omit the second clause
+		 * since if trueinc is set, we don't care about the level
+		 * at all.
+		 */
+		/* if ((!trueinc && (ddp->dd_level >= level)) ||
+		    (trueinc && (ddp->dd_level > level))) */
+		if (!trueinc && (ddp->dd_level >= level))
 			continue;
 		if (ddp->dd_ddate <= iswap32(spcl.c_ddate))
 			continue;

>Release-Note:

>Audit-Trail:
From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42952 CVS commit: src/sbin/dump
Date: Wed, 10 Mar 2010 20:32:59 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Thu Mar 11 01:32:59 UTC 2010

 Modified Files:
 	src/sbin/dump: itime.c main.c

 Log Message:
 PR/42952: The Grey Wolf: Fix for "true incremental". Don't overload level
 9, use a new level "i" which is logically 10.


 To generate a diff of this commit:
 cvs rdiff -u -r1.17 -r1.18 src/sbin/dump/itime.c
 cvs rdiff -u -r1.65 -r1.66 src/sbin/dump/main.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 25 Oct 2010 02:12:20 +0000
State-Changed-Why:
Christos committed thw patch in March.
Thanks :-)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.