|
|
b96032 |
From 18112ded916cf62b3bd3c0ffb9530e4ade3d2209 Mon Sep 17 00:00:00 2001
|
|
|
b96032 |
From: rpm-build <rpm-build>
|
|
|
b96032 |
Date: Mon, 28 Jul 2014 08:16:33 +0200
|
|
|
b96032 |
Subject: [PATCH 7/9] Document exclude mistakes with
|
|
|
b96032 |
|
|
|
b96032 |
.. usually with --no-wildcards-match-slash & --anchored options.
|
|
|
b96032 |
|
|
|
b96032 |
Upstream bugreport (still downstream):
|
|
|
b96032 |
http://www.mail-archive.com/bug-tar@gnu.org/msg04488.html
|
|
|
b96032 |
|
|
|
b96032 |
Related: #903666
|
|
|
b96032 |
|
|
|
b96032 |
---
|
|
|
b96032 |
doc/tar.texi | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
b96032 |
1 file changed, 67 insertions(+)
|
|
|
b96032 |
|
|
|
b96032 |
diff --git a/doc/tar.texi b/doc/tar.texi
|
|
|
b96032 |
index a000f3f..2695d22 100644
|
|
|
b96032 |
--- a/doc/tar.texi
|
|
|
b96032 |
+++ b/doc/tar.texi
|
|
|
b96032 |
@@ -8051,6 +8051,73 @@ The following table summarizes pattern-matching default values:
|
|
|
b96032 |
@item Exclusion @tab @option{--wildcards --no-anchored --wildcards-match-slash}
|
|
|
b96032 |
@end multitable
|
|
|
b96032 |
|
|
|
b96032 |
+@subsubsection Wildcard matching confusion
|
|
|
b96032 |
+Using of @option{--[no-]anchored} and @option{--[no-]wildcards-match-slash}
|
|
|
b96032 |
+was proven to make confusion. The reasons for this are probably different
|
|
|
b96032 |
+default setting for inclusion and exclusion patterns (in general: you shouldn't
|
|
|
b96032 |
+rely on defaults if possible) and maybe also because when using any of these two
|
|
|
b96032 |
+options, the position on command line matters (these options should be placed
|
|
|
b96032 |
+prior to the member name on command line).
|
|
|
b96032 |
+
|
|
|
b96032 |
+@noindent
|
|
|
b96032 |
+Consider following directory structure:
|
|
|
b96032 |
+
|
|
|
b96032 |
+@smallexample
|
|
|
b96032 |
+$ find path/ | sort
|
|
|
b96032 |
+path/
|
|
|
b96032 |
+path/file1
|
|
|
b96032 |
+path/file2
|
|
|
b96032 |
+path/subpath
|
|
|
b96032 |
+path/subpath/file1
|
|
|
b96032 |
+path/subpath/file2
|
|
|
b96032 |
+path/subpath2
|
|
|
b96032 |
+path/subpath2/file1
|
|
|
b96032 |
+path/subpath2/file2
|
|
|
b96032 |
+@end smallexample
|
|
|
b96032 |
+
|
|
|
b96032 |
+@noindent
|
|
|
b96032 |
+To archive full directory @samp{path} except all files named @samp{file1} may be
|
|
|
b96032 |
+reached by any of the two following commands:
|
|
|
b96032 |
+
|
|
|
b96032 |
+@smallexample
|
|
|
b96032 |
+$ tar -cf a.tar --no-wildcards-match-slash --no-anchored path \
|
|
|
b96032 |
+ --exclude='*/file1'
|
|
|
b96032 |
+$ tar -cf a.tar --wildcards-match-slash path --exclude='*/file1'
|
|
|
b96032 |
+@end smallexample
|
|
|
b96032 |
+
|
|
|
b96032 |
+@noindent
|
|
|
b96032 |
+Note that the @option{--wildcards-match-slash} and @option{--no-anchored} may be
|
|
|
b96032 |
+omitted as it is default for @option{--exclude}. Anyway, we usually want just
|
|
|
b96032 |
+concrete file (or rather subset of files with the same name). Assume we want
|
|
|
b96032 |
+exclude only files named @samp{file1} from the first subdirectory level.
|
|
|
b96032 |
+Following command obviously does not work (it still excludes all files having
|
|
|
b96032 |
+@samp{file1} name):
|
|
|
b96032 |
+
|
|
|
b96032 |
+@smallexample
|
|
|
b96032 |
+$ tar -cf a.tar --no-wildcards-match-slash path \
|
|
|
b96032 |
+ --exclude='*/file1' | sort
|
|
|
b96032 |
+@end smallexample
|
|
|
b96032 |
+
|
|
|
b96032 |
+@noindent
|
|
|
b96032 |
+This is because the @option{--no-anchored} is set by default for exclusion.
|
|
|
b96032 |
+What you need to fix is to put @option{--anchored} before pathname:
|
|
|
b96032 |
+
|
|
|
b96032 |
+@smallexample
|
|
|
b96032 |
+$ tar -cvf a.tar --no-wildcards-match-slash --anchored path \
|
|
|
b96032 |
+ --exclude='*/file1' | sort
|
|
|
b96032 |
+path/
|
|
|
b96032 |
+path/file2
|
|
|
b96032 |
+path/subpath1/
|
|
|
b96032 |
+path/subpath1/file1
|
|
|
b96032 |
+path/subpath1/file2
|
|
|
b96032 |
+path/subpath2/
|
|
|
b96032 |
+path/subpath2/file1
|
|
|
b96032 |
+path/subpath2/file2
|
|
|
b96032 |
+@end smallexample
|
|
|
b96032 |
+
|
|
|
b96032 |
+@noindent
|
|
|
b96032 |
+Similarly you can exclude second level by specifying @samp{*/*/file1}.
|
|
|
b96032 |
+
|
|
|
b96032 |
@node quoting styles
|
|
|
b96032 |
@section Quoting Member Names
|
|
|
b96032 |
|
|
|
b96032 |
--
|
|
|
b96032 |
1.9.3
|
|
|
b96032 |
|