Blame SOURCES/tar-1.28-document-exclude-mistakes.patch

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