tar/tar-1.29-wildcards.patch
DistroBaker 2556287088 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/tar.git#ac75693777079599e12a8129561f292c6c7a0c12
2021-01-25 10:52:46 +00:00

108 lines
3.6 KiB
Diff

From ae0730a98f7269a7bf7adb6047aa421939b290b7 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 28 Jul 2014 08:12:14 +0200
Subject: [PATCH] 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 | 15 +++++----------
tests/exclude01.at | 1 +
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/doc/tar.texi b/doc/tar.texi
index a8969e0..0185157 100644
--- a/doc/tar.texi
+++ b/doc/tar.texi
@@ -8439,7 +8439,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
@@ -12915,6 +12915,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 037b869..d96ad71 100644
--- a/src/names.c
+++ b/src/names.c
@@ -146,7 +146,7 @@ static struct argp_option names_options[] = {
{"no-wildcards", NO_WILDCARDS_OPTION, 0, 0,
N_("verbatim string matching"), GRID_MATCH },
{"wildcards-match-slash", WILDCARDS_MATCH_SLASH_OPTION, 0, 0,
- N_("wildcards match '/' (default for exclusion)"), GRID_MATCH },
+ N_("wildcards match '/' (default)"), GRID_MATCH },
{"no-wildcards-match-slash", NO_WILDCARDS_MATCH_SLASH_OPTION, 0, 0,
N_("wildcards do not match '/'"), GRID_MATCH },
@@ -195,8 +195,7 @@ names_parse_opt (int key, char *arg, struct argp_state *state)
/* Wildcard matching settings */
enum wildcards
{
- default_wildcards, /* For exclusion == enable_wildcards,
- for inclusion == disable_wildcards */
+ default_wildcards, /* enable_wildcards */
disable_wildcards,
enable_wildcards
};
@@ -214,7 +213,7 @@ static int include_anchored = EXCLUDE_ANCHORED;
| recursion_option)
#define INCLUDE_OPTIONS \
- (((wildcards == enable_wildcards) ? EXCLUDE_WILDCARDS : 0) \
+ (((wildcards != disable_wildcards) ? EXCLUDE_WILDCARDS : 0) \
| include_anchored \
| matching_flags \
| recursion_option)
@@ -1234,8 +1233,7 @@ regex_usage_warning (const char *name)
/* Warn about implicit use of the wildcards in command line arguments.
(Default for tar prior to 1.15.91, but changed afterwards) */
- if (wildcards == default_wildcards
- && fnmatch_pattern_has_wildcards (name, 0))
+ if (0 && fnmatch_pattern_has_wildcards (name, 0))
{
warned_once = 1;
WARN ((0, 0,
@@ -1618,10 +1616,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/tests/exclude01.at b/tests/exclude01.at
index c3cd10b..c590047 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
--
2.5.5