diff --git a/doc/tar.texi b/doc/tar.texi index db8f986..d70d113 100644 --- a/doc/tar.texi +++ b/doc/tar.texi @@ -7597,7 +7597,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 @@ -12038,6 +12038,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 ba4d509..3911f8c 100644 --- a/src/names.c +++ b/src/names.c @@ -966,10 +966,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 928cfdd..22d3db1 100644 --- a/src/tar.c +++ b/src/tar.c @@ -722,7 +722,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, @@ -815,8 +815,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 }; @@ -847,7 +846,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) @@ -2347,7 +2346,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 778a7fc..bd65ae0 100644 --- a/tests/exclude01.at +++ b/tests/exclude01.at @@ -59,6 +59,7 @@ testdir/dir2/file2 testdir/dir3/ NEXT testdir/dir1/* +testdir/dir1/file1 NEXT testdir/dir1/* NEXT