Blame SOURCES/tar-1.29-wildcards.patch

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