tar/tar-1.28-wildcards.patch
2014-07-28 10:10:16 +02:00

113 lines
3.7 KiB
Diff

From ea75b84e2408a60d75df9e68eb5683fa27209939 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 28 Jul 2014 08:12:14 +0200
Subject: [PATCH 3/9] wildcard defaults (downstram; compatibility)
Change inclusion defaults of tar to "wildcards --anchored
--wildcards-match-slash" for compatibility reasons.
Resolves: #206841
---
doc/tar.texi | 5 ++++-
src/names.c | 5 +----
src/tar.c | 9 ++++-----
tests/exclude01.at | 1 +
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/doc/tar.texi b/doc/tar.texi
index 82c303d..db79824 100644
--- a/doc/tar.texi
+++ b/doc/tar.texi
@@ -7902,7 +7902,7 @@ The following table summarizes pattern-matching default values:
@multitable @columnfractions .3 .7
@headitem Members @tab Default settings
-@item Inclusion @tab @option{--no-wildcards --anchored --no-wildcards-match-slash}
+@item Inclusion @tab @option{--wildcards --anchored --wildcards-match-slash}
@item Exclusion @tab @option{--wildcards --no-anchored --wildcards-match-slash}
@end multitable
@@ -12365,6 +12365,9 @@ version of this document is available at
@table @asis
@item Use of globbing patterns when listing and extracting.
+Note: Following is true for original unpatched GNU tar.
+For compatibility reasons, the old behavior was preserved.
+
Previous versions of GNU tar assumed shell-style globbing when
extracting from or listing an archive. For example:
diff --git a/src/names.c b/src/names.c
index 594e7fd..fe3bcad 100644
--- a/src/names.c
+++ b/src/names.c
@@ -1200,10 +1200,7 @@ collect_and_sort_names (void)
if (name->found_count || name->directory)
continue;
- if (name->matching_flags & EXCLUDE_WILDCARDS)
- /* NOTE: EXCLUDE_ANCHORED is not relevant here */
- /* FIXME: just skip regexps for now */
- continue;
+
chdir_do (name->change_dir);
if (name->name[0] == 0)
diff --git a/src/tar.c b/src/tar.c
index cd32379..79b0a10 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -800,7 +800,7 @@ static struct argp_option options[] = {
{"no-ignore-case", NO_IGNORE_CASE_OPTION, 0, 0,
N_("case sensitive matching (default)"), GRID+1 },
{"wildcards", WILDCARDS_OPTION, 0, 0,
- N_("use wildcards (default for exclusion)"), GRID+1 },
+ N_("use wildcards (default)"), GRID+1 },
{"no-wildcards", NO_WILDCARDS_OPTION, 0, 0,
N_("verbatim string matching"), GRID+1 },
{"no-wildcards-match-slash", NO_WILDCARDS_MATCH_SLASH_OPTION, 0, 0,
@@ -895,8 +895,7 @@ ARGMATCH_VERIFY (atime_preserve_args, atime_preserve_types);
/* Wildcard matching settings */
enum wildcards
{
- default_wildcards, /* For exclusion == enable_wildcards,
- for inclusion == disable_wildcards */
+ default_wildcards, /* enable_wildcards */
disable_wildcards,
enable_wildcards
};
@@ -927,7 +926,7 @@ struct tar_args /* Variables used during option parsing */
| recursion_option)
#define MAKE_INCL_OPTIONS(args) \
- ((((args)->wildcards == enable_wildcards) ? EXCLUDE_WILDCARDS : 0) \
+ ((((args)->wildcards != disable_wildcards) ? EXCLUDE_WILDCARDS : 0) \
| (args)->include_anchored \
| (args)->matching_flags \
| recursion_option)
@@ -2442,7 +2441,7 @@ decode_options (int argc, char **argv)
/* Warn about implicit use of the wildcards in command line arguments.
See TODO */
- warn_regex_usage = args.wildcards == default_wildcards;
+ warn_regex_usage = 0; /* args.wildcards == default_wildcards; */
/* Derive option values and check option consistency. */
diff --git a/tests/exclude01.at b/tests/exclude01.at
index 27dd9fe..61e5910 100644
--- a/tests/exclude01.at
+++ b/tests/exclude01.at
@@ -61,6 +61,7 @@ testdir/dir2/file2
testdir/dir3/
NEXT
testdir/dir1/*
+testdir/dir1/file1
NEXT
testdir/dir1/*
NEXT
--
1.9.3