Blame SOURCES/tar-1.29-wildcards.patch

b96032
From ae0730a98f7269a7bf7adb6047aa421939b290b7 Mon Sep 17 00:00:00 2001
b96032
From: rpm-build <rpm-build>
b96032
Date: Mon, 28 Jul 2014 08:12:14 +0200
b96032
Subject: [PATCH] wildcard defaults (downstram; compatibility)
b96032
b96032
Change inclusion defaults of tar to "wildcards --anchored
b96032
--wildcards-match-slash" for compatibility reasons.
b96032
b96032
Resolves: #206841
b96032
---
b96032
 doc/tar.texi       |  5 ++++-
b96032
 src/names.c        | 15 +++++----------
b96032
 tests/exclude01.at |  1 +
b96032
 3 files changed, 10 insertions(+), 11 deletions(-)
b96032
b96032
diff --git a/doc/tar.texi b/doc/tar.texi
b96032
index a8969e0..0185157 100644
b96032
--- a/doc/tar.texi
b96032
+++ b/doc/tar.texi
b96032
@@ -8439,7 +8439,7 @@ The following table summarizes pattern-matching default values:
b96032
 
b96032
 @multitable @columnfractions .3 .7
b96032
 @headitem Members @tab Default settings
b96032
-@item Inclusion @tab @option{--no-wildcards --anchored --no-wildcards-match-slash}
b96032
+@item Inclusion @tab @option{--wildcards --anchored --wildcards-match-slash}
b96032
 @item Exclusion @tab @option{--wildcards --no-anchored --wildcards-match-slash}
b96032
 @end multitable
b96032
 
b96032
@@ -12915,6 +12915,9 @@ version of this document is available at
b96032
 @table @asis
b96032
 @item Use of globbing patterns when listing and extracting.
b96032
 
b96032
+Note: Following is true for original unpatched GNU tar.
b96032
+For compatibility reasons, the old behavior was preserved.
b96032
+
b96032
 Previous versions of GNU tar assumed shell-style globbing when
b96032
 extracting from or listing an archive.  For example:
b96032
 
b96032
diff --git a/src/names.c b/src/names.c
b96032
index 037b869..d96ad71 100644
b96032
--- a/src/names.c
b96032
+++ b/src/names.c
b96032
@@ -146,7 +146,7 @@ static struct argp_option names_options[] = {
b96032
   {"no-wildcards", NO_WILDCARDS_OPTION, 0, 0,
b96032
    N_("verbatim string matching"), GRID_MATCH },
b96032
   {"wildcards-match-slash", WILDCARDS_MATCH_SLASH_OPTION, 0, 0,
b96032
-   N_("wildcards match '/' (default for exclusion)"), GRID_MATCH },
b96032
+   N_("wildcards match '/' (default)"), GRID_MATCH },
b96032
   {"no-wildcards-match-slash", NO_WILDCARDS_MATCH_SLASH_OPTION, 0, 0,
b96032
    N_("wildcards do not match '/'"), GRID_MATCH },
b96032
 
b96032
@@ -195,8 +195,7 @@ names_parse_opt (int key, char *arg, struct argp_state *state)
b96032
 /* Wildcard matching settings */
b96032
 enum wildcards
b96032
   {
b96032
-    default_wildcards, /* For exclusion == enable_wildcards,
b96032
-			  for inclusion == disable_wildcards */
b96032
+    default_wildcards, /* enable_wildcards */
b96032
     disable_wildcards,
b96032
     enable_wildcards
b96032
   };
b96032
@@ -214,7 +213,7 @@ static int include_anchored = EXCLUDE_ANCHORED;
b96032
   | recursion_option)
b96032
 
b96032
 #define INCLUDE_OPTIONS						    \
b96032
-  (((wildcards == enable_wildcards) ? EXCLUDE_WILDCARDS : 0)	    \
b96032
+  (((wildcards != disable_wildcards) ? EXCLUDE_WILDCARDS : 0)	    \
b96032
   | include_anchored						    \
b96032
   | matching_flags						    \
b96032
   | recursion_option)
b96032
@@ -1234,8 +1233,7 @@ regex_usage_warning (const char *name)
b96032
 
b96032
   /* Warn about implicit use of the wildcards in command line arguments.
b96032
      (Default for tar prior to 1.15.91, but changed afterwards) */
b96032
-  if (wildcards == default_wildcards
b96032
-      && fnmatch_pattern_has_wildcards (name, 0))
b96032
+  if (0 && fnmatch_pattern_has_wildcards (name, 0))
b96032
     {
b96032
       warned_once = 1;
b96032
       WARN ((0, 0,
b96032
@@ -1618,10 +1616,7 @@ collect_and_sort_names (void)
b96032
 
b96032
       if (name->found_count || name->directory)
b96032
 	continue;
b96032
-      if (name->matching_flags & EXCLUDE_WILDCARDS)
b96032
-	/* NOTE: EXCLUDE_ANCHORED is not relevant here */
b96032
-	/* FIXME: just skip regexps for now */
b96032
-	continue;
b96032
+
b96032
       chdir_do (name->change_dir);
b96032
 
b96032
       if (name->name[0] == 0)
b96032
diff --git a/tests/exclude01.at b/tests/exclude01.at
b96032
index c3cd10b..c590047 100644
b96032
--- a/tests/exclude01.at
b96032
+++ b/tests/exclude01.at
b96032
@@ -61,6 +61,7 @@ testdir/dir2/file2
b96032
 testdir/dir3/
b96032
 NEXT
b96032
 testdir/dir1/*
b96032
+testdir/dir1/file1
b96032
 NEXT
b96032
 testdir/dir1/*
b96032
 NEXT
b96032
-- 
b96032
2.5.5
b96032