Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jan 1997 03:22:51 +0100
From:      Tor Egge <Tor.Egge@idt.ntnu.no>
To:        lucifer@maths.uq.oz.au
Cc:        freebsd-bugs@freefall.freebsd.org
Subject:   Re: bin/2446: Problem in interactive restore.
Message-ID:  <199701200222.DAA17675@pat.idt.unit.no>
In-Reply-To: Your message of "Sat, 11 Jan 1997 19:30:06 -0800 (PST)"
References:  <199701120330.TAA28001@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> The following reply was made to PR bin/2446; it has been noted by GNATS.
> 
> From: David Conran <lucifer@maths.uq.oz.au>
> To: joerg_wunsch@uriah.heep.sax.de
> Cc: lucifer@xyzzy.net.au, FreeBSD-gnats-submit@freebsd.org
> Subject: Re: bin/2446: Problem in interactive restore.
> Date: Sun, 12 Jan 1997 13:24:06 +1000 (EST)
> 
>  J Wunsch writes ...
>  > 
>  > As David Conran wrote:
>  > 
>  > > orac:/tmp$ restore ivf /dev/nrst1
>  > > Verify tape and initialize maps
>  > > Tape block size is 32
>  > > Dump   date: Mon Jan  6 00:39:10 1997
>  > > Dumped from: the epoch
>  > > Level 0 dump of /usr on orac.xyzzy.net.au:/dev/sd0e
>  > > Label: none
>  > > Extract directories from tape
>  > > Initialize symbol table.
>  > > restore > cd include
>  > > canonname: not enough bufferspace
>  > 
>  > Can you perhaps track this with gdb?  Interactive restore works fine
>  > for me (and worked all the time), so i probably have a hard time to
>  > reproduce this.
>  > 
>  > (Hint: send followups to your PR to freebsd-gnats-submit@freebsd.org,
>  > using the same subject.)
>  
>  Well .. I just re-suped and recompiled restore .. and did it off a very
>  recent (ie. 3.0-current) dump
>  
>  I am no gdb expert .. so .. here is my stuff.
>  (if there is something else to do .. let me know.)
>  Thanks.


I recently experienced the same problem with 3.0-current. 
Here is a patch that worked for me. 

This patch also adds some more byteswapping when restoring a backup
made with a bigendian system. This is needed to avoid treating
level 1 dumps as level 16777216 dumps.

- Tor Egge

-------
Index: interactive.c
===================================================================
RCS file: /usr/cvs/src/sbin/restore/interactive.c,v
retrieving revision 1.2
diff -c -r1.2 interactive.c
*** interactive.c	1997/01/01 14:08:45	1.2
--- interactive.c	1997/01/20 01:43:36
***************
*** 82,88 ****
  static char	*copynext __P((char *, char *));
  static int	 fcmp __P((const void *, const void *));
  static void	 formatf __P((struct afile *, int));
! static void	 getcmd __P((char *, char *, char *, struct arglist *));
  struct dirent	*glob_readdir __P((RST_DIR *dirp));
  static int	 glob_stat __P((const char *, struct stat *));
  static void	 mkentry __P((struct direct *, struct afile *));
--- 82,88 ----
  static char	*copynext __P((char *, char *));
  static int	 fcmp __P((const void *, const void *));
  static void	 formatf __P((struct afile *, int));
! static void	 getcmd __P((char *, char *, char *, size_t, struct arglist *));
  struct dirent	*glob_readdir __P((RST_DIR *dirp));
  static int	 glob_stat __P((const char *, struct stat *));
  static void	 mkentry __P((struct direct *, struct afile *));
***************
*** 121,127 ****
  		volno = 0;
  	}
  	runshell = 1;
! 	getcmd(curdir, cmd, name, &arglist);
  	switch (cmd[0]) {
  	/*
  	 * Add elements to the extraction list.
--- 121,127 ----
  		volno = 0;
  	}
  	runshell = 1;
! 	getcmd(curdir, cmd, name, sizeof(name), &arglist);
  	switch (cmd[0]) {
  	/*
  	 * Add elements to the extraction list.
***************
*** 300,307 ****
   * eliminate any embedded ".." components.
   */
  static void
! getcmd(curdir, cmd, name, ap)
  	char *curdir, *cmd, *name;
  	struct arglist *ap;
  {
  	register char *cp;
--- 300,308 ----
   * eliminate any embedded ".." components.
   */
  static void
! getcmd(curdir, cmd, name, namelen, ap)
  	char *curdir, *cmd, *name;
+ 	size_t namelen;
  	struct arglist *ap;
  {
  	register char *cp;
***************
*** 357,363 ****
  	 * If it is an absolute pathname, canonicalize it and return it.
  	 */
  	if (rawname[0] == '/') {
! 		canon(rawname, name, sizeof(name));
  	} else {
  		/*
  		 * For relative pathnames, prepend the current directory to
--- 358,364 ----
  	 * If it is an absolute pathname, canonicalize it and return it.
  	 */
  	if (rawname[0] == '/') {
! 		canon(rawname, name, namelen);
  	} else {
  		/*
  		 * For relative pathnames, prepend the current directory to
***************
*** 366,372 ****
  		(void) strcpy(output, curdir);
  		(void) strcat(output, "/");
  		(void) strcat(output, rawname);
! 		canon(output, name, sizeof(name));
  	}
  	if (glob(name, GLOB_ALTDIRFUNC, NULL, &ap->glob) < 0)
  		fprintf(stderr, "%s: out of memory\n", ap->cmd);
--- 367,373 ----
  		(void) strcpy(output, curdir);
  		(void) strcat(output, "/");
  		(void) strcat(output, rawname);
! 		canon(output, name, namelen);
  	}
  	if (glob(name, GLOB_ALTDIRFUNC, NULL, &ap->glob) < 0)
  		fprintf(stderr, "%s: out of memory\n", ap->cmd);
Index: tape.c
===================================================================
RCS file: /usr/cvs/src/sbin/restore/tape.c,v
retrieving revision 1.6
diff -c -r1.6 tape.c
*** tape.c	1997/01/01 14:08:47	1.6
--- tape.c	1997/01/20 01:44:37
***************
*** 1022,1029 ****
  		}
  		if (checksum((int *)buf) == FAIL)
  			return (FAIL);
! 		if (Bcvt)
  			swabst((u_char *)"8l4s31l", (u_char *)buf);
  		goto good;
  	}
  	readtape((char *)(&u_ospcl.s_ospcl));
--- 1022,1032 ----
  		}
  		if (checksum((int *)buf) == FAIL)
  			return (FAIL);
! 		if (Bcvt) {
  			swabst((u_char *)"8l4s31l", (u_char *)buf);
+                         swabst((u_char *)"l",(u_char *) &buf->c_level);
+                         swabst((u_char *)"2l",(u_char *) &buf->c_flags);
+ 	        }
  		goto good;
  	}
  	readtape((char *)(&u_ospcl.s_ospcl));
------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701200222.DAA17675>