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

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