[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug (and fix) for --exclude-from
From: |
Allan Nathanson |
Subject: |
Bug (and fix) for --exclude-from |
Date: |
Thu, 1 Nov 2001 16:48:18 -0500 |
Hi -
I've been wrestling with GNU tar's "--exclude-from" option and believe I
have found a problem (or I've completely missed what functionality the
option is supposed to provide).
Suppose that I have the following directory hierarchy that I would like to
archive:
x/a
x/b/foo
x/c
x/d/foo
x/e
...
I would like to archive everything all of the files/directories except for
"x/b/foo". In my initial attempts to use the "--exclude-from" option I
specified a file containing "x/b/foo". Based on the current code this
wouldn't work since only the filename component is checked. Changing the
exclude file to include just "foo" kept "x/b/foo" out of the archive but
also excluded "x/d/foo". My belief is that the full path should also be
compared against the exclude list. This will facilitate exclusions based
on the "all files/directories with a given name" *AND* "specific
files/directories".
Here's a patch which compares the full path to the exclude list:
diff -u -d -b -w -r1.1.1.2 create.c
--- create.c 2000/05/06 23:28:33 1.1.1.2
+++ create.c 2001/11/01 21:45:29
@@ -1496,6 +1496,11 @@
#endif
}
strcpy (namebuf + len, entry->d_name);
+
+ /* Skip excluded path names. */
+ if (excluded_filename (excluded, namebuf))
+ continue;
+
dump_file (namebuf, our_device, 0);
}
Comments?
- Allan Nathanson
Apple, Core OS
- Bug (and fix) for --exclude-from,
Allan Nathanson <=