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