Blame SOURCES/tar-1.29-wildcards.patch

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