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

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