[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [BusyBox] tar fixes
From:       Arne Bernin <ab () netropol ! de>
Date:       2000-12-20 22:13:03
[Download RAW message or body]

On Tue, Dec 19, 2000 at 12:52:30PM -0800, Matt Kraai wrote:
> 
> Whoops.  I forgot that I need to use the full path when accessing
> the file and the stripped one when writing the header.  A fix is
> committed.

;-)
yes it works.

but i have some more thoughts about bb tar:

on LRP the tar used to create the archives is ctar. If you make something
like:
ctar -x /home/arne/busybox /home/arne/busybox/docs
it would still backup /home/arne/busybox/docs and ignores the exclusion of
that one directory (backing up /home/arne would exclude busybox).
It would be very nice to get this into bb tar, to get rid of ctar, but this
feature is needed to backup LRP properly. (There might be others, like
support for basic regular expressions (files*)).
Attached is a first "dirty" hack to make this possible. What do you think?
Or should it be made optional?
 
I also think there are more little cleanups (like avoiding /tmp//hallo/dir)
to do, and would be likely spending some time in it...

-- arne
-------------------------------------------------------------------
Arne Bernin                            	Netropol Digitale Systeme
					Lagerstrasse 30a                        
Tel: +49 4043250000                     D-20357 Hamburg/Germany
Fax: +49 40 43189490                    ab@Netropol.de    
                                                             
    
["tar-ex-in.patch" (text/plain)]

--- busybox/tar.c	Wed Dec 20 22:56:42 2000
+++ busybox/tar.c	Wed Dec 20 22:51:46 2000
@@ -844,6 +844,7 @@
 									 to include the tarball into itself */
 	int verboseFlag;              /* Whether to print extra stuff or not */
 	char** excludeList;           /* List of files to not include */
+        char* comName;                /* Current name of commandline arg(file)*/
 	HardLinkInfo *hlInfoHead;     /* Hard Link Tracking Information */
 	HardLinkInfo *hlInfo;         /* Hard Link Info for the current file */
 };
@@ -1091,6 +1092,9 @@
 
 #if defined BB_FEATURE_TAR_EXCLUDE
 	/* Check for excluded files....  */
+	if (tbInfo->comName[0] == '/') {
+	  tbInfo->comName++ ;
+	}
 	for (tmpList=tbInfo->excludeList; tmpList && *tmpList; tmpList++) {
 		/* Do some extra hoop jumping for when directory names
 		 * end in '/' but the entry in tmpList doesn't */
@@ -1098,6 +1102,12 @@
 					fileName[strlen(fileName)-1]=='/'
 					&& strncmp( *tmpList, fileName, 
 						MIN(strlen(fileName)-1, strlen(*tmpList)))==0)) {
+		/* Now if we were called to do this explicitly,
+		     we should do it and ignore the exclude for this dir/file */
+		if (strncmp( *tmpList,tbInfo->comName , strlen(*tmpList))==0) {
+		  continue;
+		}
+		/* else skip it */
 			return SKIP;
 		}
 	}
@@ -1179,6 +1189,7 @@
 
 	/* Read the directory/files and iterate over them one at a time */
 	while (*argv != NULL) {
+		tbInfo.comName = *argv;
 		if (recursive_action(*argv++, TRUE, FALSE, FALSE,
 					writeFileToTarball, writeFileToTarball, 
 					(void*) &tbInfo) == FALSE) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic