Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

user/3324: bug in multi-volume restores

From: Rodger Allen <zebedee.wa(at)bigpond.com>
Date: Wed Jun 18 2003 - 21:22:05 EDT


>Number: 3324
>Category: user
>Synopsis: multi-volume restore does not allow selection of next volume
>Confidential: yes
net
>Environment:

	System      : OpenBSD 3.3
	Architecture: OpenBSD.i386
	Machine     : i386

>Description:
When selecting the filename for the next volume in a multi-volume
    dump, restore prompts for the filename, but then does not strip the     trainling '\n' from the input. This filename + '\n' is not able to     be opened, and restore goes into a loop of prompting and failing.

    I have only tested this with "real" files on the filesystem, and     haven't traced whether it affects restore from rmt or a tape device.     My guess is that anyone who has done a restore from a tape device     just changes the tape at this point and keeps the filename as-is.

>How-To-Repeat:

        Create a multi-volume dump (add as many filenames as are necessary):     # dump -0 -B 10000 -f 1.dump,2.dump /

    Restore (starting with the first volume):

    # cd /newfs
    # restore xvf /path/to/1.dump /sbin
    Initialize symbol table.
    Make node ./home
    Extract requested files
    You have not read any tapes yet.
    Unless you know which volume your file(s) are on you should start     with the last volume and work towards the first.     Specify next volume #: 1
    extract file ./sbin/dhclient
    End-of-tape encountered
    Mount tape volume 2
    Enter ``none'' if there are no more tapes     otherwise enter tape name (default: 1.dump) 2.dump     Cannot open 2.dump
    <blank line>

>Fix:

    Apply the patch (or something akin), which removes the trailing '\n'     from the next filename input.

Do you need help?X

    A workaround is to link to a "mock-tape" file the first dump volume,     and then recreate the softlink for each of the other volumes in turn     when they are called for by restore, ie, change the mock-tape.

Index: tape.c



RCS file: /cvs/src/sbin/restore/tape.c,v retrieving revision 1.22
diff -u -r1.22 tape.c
--- tape.c	2003/03/13 05:00:44	1.22
+++ tape.c	2003/06/02 00:45:51
@@ -346,9 +346,12 @@
 		terminateinput();
 		return;
 	}
-	if (buf[0] != '\n')
+	if (buf[0] != '\n') {
+		int n = strlen(buf);
+		if (n > 0 && buf[n-1] == '\n')
+			buf[--n] = '\0';
 		(void)strlcpy(magtape, buf, sizeof magtape);
-
+	}
 #ifdef RRESTORE
 	if (host)
 		mt = rmtopen(magtape, 0);

# vi:et ai ts=4 textwidth=72

>Release-Note:
Received on Wed Jun 18 21:40:21 2003

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:58 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library