rebase: latest upstream release v1.30

Per upstream release notes:
http://lists.gnu.org/archive/html/info-gnu/2017-12/msg00011.html

Version: 1.30-1
This commit is contained in:
Pavel Raiskup 2017-12-18 12:57:02 +01:00
parent 2858c8d1dd
commit c0ab324711
7 changed files with 11 additions and 794 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
/tar-1.29.tar.xz
/tar-1.29.tar.xz.sig
/tar-1.30.tar.xz
/tar-1.30.tar.xz.sig

View File

@ -1,2 +1,2 @@
a1802fec550baaeecff6c381629653ef tar-1.29.tar.xz
34219e18adf27b7b0ce3548013ec09d8 tar-1.29.tar.xz.sig
SHA512 (tar-1.30.tar.xz) = 9c8b2cacf8f6ca1b19f788d4ec0410127c4d71e54b9c9cac99ee5af6c002189ccc521302955510bb22a54a069ffd00fc2de12ac776985cbbeb3f1ecf38a4f8d9
SHA512 (tar-1.30.tar.xz.sig) = 149bfb112aae05e1f40a26ab2570fef71cf736eac62bf3a1bc8df905270c745500fc82764867323e440c67b1dd7116f5b0e1fd1977be7f10b333d481da3355e8

View File

@ -1,122 +0,0 @@
From fecf72d73021fa47956ea551f6ccc804213452ce Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Wed, 4 Apr 2012 18:04:53 +0200
Subject: [PATCH 5/9] Bad cooperation of -C and -u options
Previously, tar did not update archive with newly created files in archived
directory -- it failed instead with "file not found" error (because it looked
in bad directory in filesystem).
---
src/update.c | 2 +-
tests/Makefile.am | 1 +
tests/testsuite.at | 1 +
tests/update03.at | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 62 insertions(+), 1 deletion(-)
create mode 100644 tests/update03.at
diff --git a/src/update.c b/src/update.c
index c8fca0c..9a9c4e2 100644
--- a/src/update.c
+++ b/src/update.c
@@ -152,7 +152,7 @@ update_archive (void)
for (p = dirp; *p; p += strlen (p) + 1)
addname (namebuf_name (nbuf, p),
- 0, false, NULL);
+ name->change_dir, false, NULL);
namebuf_free (nbuf);
free (dirp);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6684d1d..2a2e1cc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -208,6 +208,7 @@ TESTSUITE_AT = \
update.at\
update01.at\
update02.at\
+ update03.at\
volsize.at\
volume.at\
verbose.at\
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 7f8e4c4..f1ce58f 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -360,6 +360,7 @@ AT_BANNER([Updates])
m4_include([update.at])
m4_include([update01.at])
m4_include([update02.at])
+m4_include([update03.at])
AT_BANNER([Verifying the archive])
m4_include([verify.at])
diff --git a/tests/update03.at b/tests/update03.at
new file mode 100644
index 0000000..185f9eb
--- /dev/null
+++ b/tests/update03.at
@@ -0,0 +1,59 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+
+# Test suite for GNU tar.
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 3, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+# Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Description:
+# Test if the '--update' option works with the '--directory DIR' option
+# properly. In version <= 1.26 tar this combination caused problems.
+#
+# References:
+# https://bugzilla.redhat.com/show_bug.cgi?id=688567
+#
+# Last-Affected-Version: 1.26.90
+
+AT_SETUP([update & change directory (-C)])
+AT_KEYWORDS([update update03])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+
+# prepare filesystem
+mkdir dir
+mkdir dir/subdir
+genfile --file dir/subdir/a
+
+# crate archive of subdir
+tar -C dir -cf file.tar subdir
+
+# update filesystem
+mkdir dir/subdir/b
+genfile --file dir/subdir/b/c
+
+# sync the 'file.tar' archive
+tar -C dir -uf file.tar subdir
+
+# print contents
+tar -tf file.tar | sort || exit 1
+],
+[0],
+[subdir/
+subdir/a
+subdir/b/
+subdir/b/c
+])
+
+AT_CLEANUP
--
1.9.3

View File

@ -1,293 +0,0 @@
From 7f6d7043332d3d4029ada9ac8e66e2ef9422046e Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Sat, 12 Nov 2016 11:20:47 +0200
Subject: [PATCH] Fix the --add-file option.
* src/common.h (name_more_files): New proto.
(files_from_option): Remove.
* src/names.c (name_more_files): New file.
(names_options): Fix declaration of the
add-file option.
(names_parse_opt): Handle --add-file.
* src/tar.c (struct tar_args): Remove the input_files member.
Change all uses: use name_more_files() instead.
* tests/Makefile.am: Add new test.
* tests/add-file.at: New testcase.
* tests/testsuite.at: Add new test.
---
src/common.h | 4 +---
src/names.c | 20 +++++++++++-----
src/tar.c | 16 ++++---------
tests/Makefile.am | 3 ++-
tests/add-file.at | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/testsuite.at | 2 ++
6 files changed, 91 insertions(+), 21 deletions(-)
create mode 100644 tests/add-file.at
diff --git a/src/common.h b/src/common.h
index 50c34cc..6fdb622 100644
--- a/src/common.h
+++ b/src/common.h
@@ -414,9 +414,6 @@ GLOBAL bool show_transformed_names_option;
timestamps from archives with an unusual member order. It is automatically
set for incremental archives. */
GLOBAL bool delay_directory_restore_option;
-
-/* When set, tar will not refuse to create empty archives */
-GLOBAL bool files_from_option;
/* Declarations for each module. */
@@ -738,6 +735,7 @@ void uid_to_uname (uid_t uid, char **uname);
int uname_to_uid (char const *uname, uid_t *puid);
void name_init (void);
+bool name_more_files (void);
void name_add_name (const char *name);
void name_term (void);
const char *name_next (int change_dirs);
diff --git a/src/names.c b/src/names.c
index d96ad71..57d97e2 100644
--- a/src/names.c
+++ b/src/names.c
@@ -32,7 +32,8 @@ static void name_add_file (const char *name);
enum
{
- EXCLUDE_BACKUPS_OPTION = 256,
+ ADD_FILE_OPTION = 256,
+ EXCLUDE_BACKUPS_OPTION,
EXCLUDE_CACHES_OPTION,
EXCLUDE_CACHES_UNDER_OPTION,
EXCLUDE_CACHES_ALL_OPTION,
@@ -67,7 +68,7 @@ static struct argp_option names_options[] = {
{NULL, 0, NULL, 0,
N_("Local file name selection:"), GRID },
- {"add-file", ARGP_KEY_ARG, N_("FILE"), 0,
+ {"add-file", ADD_FILE_OPTION, N_("FILE"), 0,
N_("add given FILE to the archive (useful if its name starts with a dash)"), GRID+1 },
{"directory", 'C', N_("DIR"), 0,
N_("change to directory DIR"), GRID+1 },
@@ -177,10 +178,10 @@ names_parse_opt (int key, char *arg, struct argp_state *state)
case 'T':
name_add_file (arg);
- /* Indicate we've been given -T option. This is for backward
- compatibility only, so that `tar cfT archive /dev/null will
- succeed */
- files_from_option = true;
+ break;
+
+ case ADD_FILE_OPTION:
+ name_add_name (arg);
break;
default:
@@ -680,6 +681,12 @@ name_list_advance (void)
free (elt);
}
+/* Return true if there are names or options in the list */
+bool
+name_more_files (void)
+{
+ return name_count > 0;
+}
/* Add to name_array the file NAME with fnmatch options MATFLAGS */
void
@@ -719,6 +726,7 @@ name_add_file (const char *name)
ep->v.file.name = name;
ep->v.file.line = 0;
ep->v.file.fp = NULL;
+ name_count++;
}
/* Names from external name file. */
diff --git a/src/tar.c b/src/tar.c
index ba24c43..685fc8e 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -813,7 +813,6 @@ struct tar_args /* Variables used during option parsing */
bool pax_option; /* True if --pax-option was given */
char const *backup_suffix_string; /* --suffix option argument */
char const *version_control_string; /* --backup option argument */
- bool input_files; /* True if some input files where given */
int compress_autodetect; /* True if compression autodetection should
be attempted when creating archives */
};
@@ -1322,7 +1321,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
case ARGP_KEY_ARG:
/* File name or non-parsed option, because of ARGP_IN_ORDER */
name_add_name (arg);
- args->input_files = true;
break;
case 'A':
@@ -2179,7 +2177,7 @@ more_options (int argc, char **argv, struct option_locus *loc)
args.loc = loc;
if (argp_parse (&argp, argc, argv, ARGP_IN_ORDER|ARGP_NO_EXIT, &idx, &args))
abort (); /* shouldn't happen */
- if (loc->source == OPTS_ENVIRON && args.input_files)
+ if (loc->source == OPTS_ENVIRON && name_more_files ())
USAGE_ERROR ((0, 0, _("non-option arguments in %s"), loc->name));
}
@@ -2220,7 +2218,6 @@ decode_options (int argc, char **argv)
args.pax_option = false;
args.backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
args.version_control_string = 0;
- args.input_files = false;
args.compress_autodetect = false;
subcommand_option = UNKNOWN_SUBCOMMAND;
@@ -2339,10 +2336,7 @@ decode_options (int argc, char **argv)
/* Handle operands after any "--" argument. */
for (; idx < argc; idx++)
- {
- name_add_name (argv[idx]);
- args.input_files = true;
- }
+ name_add_name (argv[idx]);
/* Derive option values and check option consistency. */
@@ -2364,7 +2358,7 @@ decode_options (int argc, char **argv)
if (occurrence_option)
{
- if (!args.input_files)
+ if (!name_more_files ())
USAGE_ERROR ((0, 0,
_("--occurrence is meaningless without a file list")));
if (!IS_SUBCOMMAND_CLASS (SUBCL_OCCUR))
@@ -2568,7 +2562,7 @@ decode_options (int argc, char **argv)
{
/* --test-label is silent if the user has specified the label name to
compare against. */
- if (!args.input_files)
+ if (!name_more_files ())
verbose_option++;
}
else if (utc_option)
@@ -2597,7 +2591,7 @@ decode_options (int argc, char **argv)
switch (subcommand_option)
{
case CREATE_SUBCOMMAND:
- if (!args.input_files && !files_from_option)
+ if (!name_more_files ())
USAGE_ERROR ((0, 0,
_("Cowardly refusing to create an empty archive")));
if (args.compress_autodetect && archive_names
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4f3b918..c8fa922 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -42,6 +42,7 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
## ------------ ##
TESTSUITE_AT = \
+ testsuite.at\
T-cd.at\
T-dir00.at\
T-dir01.at\
@@ -54,7 +55,7 @@ TESTSUITE_AT = \
T-nonl.at\
T-mult.at\
T-nest.at\
- testsuite.at\
+ add-file.at\
append.at\
append01.at\
append02.at\
diff --git a/tests/add-file.at b/tests/add-file.at
new file mode 100644
index 0000000..97003ff
--- /dev/null
+++ b/tests/add-file.at
@@ -0,0 +1,67 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright 2016 Free Software Foundation, Inc.
+#
+# This file is part of GNU tar.
+#
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([The --add-file option])
+AT_KEYWORDS([add-file])
+
+# Version 1.29 would give "tar: Cowardly refusing to create an empty archive"
+# if only --add-file arguments were used, and would give "tar: unhandled
+# positional option 0" when handling the --add-file if at least one file was
+# also given normally.
+#
+# Reported by: James Clarke <jrtc27@jrtc27.com>
+# References: <20161112000246.77013-1-jrtc27@jrtc27.com>,
+# http://lists.gnu.org/archive/html/bug-tar/2016-11/msg00013.html
+
+AT_TAR_CHECK([
+genfile --file -File
+genfile --file foo
+genfile --file bar
+
+echo 1:
+tar -cvf arc.tar --add-file foo --add-file -File
+
+echo 2:
+tar -cvf arc.tar foo --add-file -File bar
+
+
+AT_DATA([input],[foo
+--add-file=-File
+bar
+])
+
+echo 3:
+tar -cvf arc.tar -T input
+],
+[0],
+[1:
+foo
+-File
+2:
+foo
+-File
+bar
+3:
+foo
+-File
+bar
+])
+
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 9493641..e97e5cb 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -213,6 +213,8 @@ m4_include([opcomp04.at])
m4_include([opcomp05.at])
m4_include([opcomp06.at])
+m4_include([add-file.at])
+
AT_BANNER([The -T option])
m4_include([T-mult.at])
m4_include([T-nest.at])
--
2.9.4

View File

@ -1,153 +0,0 @@
From 313fa7700598821fa35e502955cf110632d4318d Mon Sep 17 00:00:00 2001
From: Ian McLeod <imcleod@redhat.com>
Date: Mon, 28 Nov 2016 06:56:00 +0100
Subject: [PATCH] Bugfix - fix xattr exclude/include for archive create
This makes archive create behavior consistent with the
documentation. Without this change xattr include/exclude options
are accepted when creating an archive but are silently ignored.
* src/xattrs.c (xattrs_xattrs_get): Apply exclude/include mask
when fetching extended attributes
* tests/Makefile.am: Add new test case.
* tests/testsuite.at: Likewise.
This commit includes c81a0853bb8c5c6d78a commit also. Patch given
by 'git diff c81a0853b^^..c81a0853b'.
---
src/xattrs.c | 15 ++++++++++-----
tests/Makefile.am | 1 +
tests/testsuite.at | 1 +
tests/xattr06.at | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+), 5 deletions(-)
create mode 100644 tests/xattr06.at
diff --git a/src/xattrs.c b/src/xattrs.c
index 8e56168..d9f1f8b 100644
--- a/src/xattrs.c
+++ b/src/xattrs.c
@@ -434,8 +434,12 @@ xattrs_clear_setup (void)
clear_mask_map (&xattrs_setup.excl);
}
-/* get all xattrs from file given by FILE_NAME or FD (when non-zero). This
- includes all the user.*, security.*, system.*, etc. available domains */
+static bool xattrs_masked_out (const char *kw, bool archiving);
+
+/* get xattrs from file given by FILE_NAME or FD (when non-zero)
+ xattrs are checked against the user supplied include/exclude mask
+ if no mask is given this includes all the user.*, security.*, system.*,
+ etc. available domains */
void
xattrs_xattrs_get (int parentfd, char const *file_name,
struct tar_stat_info *st, int fd)
@@ -480,8 +484,6 @@ xattrs_xattrs_get (int parentfd, char const *file_name,
size_t len = strlen (attr);
ssize_t aret = 0;
- /* Archive all xattrs during creation, decide at extraction time
- * which ones are of interest/use for the target filesystem. */
while (((fd == 0)
? ((aret = lgetxattrat (parentfd, file_name, attr,
val, asz)) == -1)
@@ -492,7 +494,10 @@ xattrs_xattrs_get (int parentfd, char const *file_name,
}
if (aret != -1)
- xheader_xattr_add (st, attr, val, aret);
+ {
+ if (!xattrs_masked_out (attr, true))
+ xheader_xattr_add (st, attr, val, aret);
+ }
else if (errno != ENOATTR)
call_arg_warn ((fd == 0) ? "lgetxattrat"
: "fgetxattr", file_name);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ce9b5b2..abc17a4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -242,6 +242,7 @@ TESTSUITE_AT = \
xattr03.at\
xattr04.at\
xattr05.at\
+ xattr06.at\
acls01.at\
acls02.at\
acls03.at\
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 9a792c8..db83c80 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -439,6 +439,7 @@ m4_include([xattr02.at])
m4_include([xattr03.at])
m4_include([xattr04.at])
m4_include([xattr05.at])
+m4_include([xattr06.at])
m4_include([acls01.at])
m4_include([acls02.at])
diff --git a/tests/xattr06.at b/tests/xattr06.at
new file mode 100644
index 0000000..691f7e7
--- /dev/null
+++ b/tests/xattr06.at
@@ -0,0 +1,56 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright 2012-2014, 2016 Free Software Foundation, Inc.
+
+# This file is part of GNU tar.
+
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Test description: Test for exclude of xattr during archive creation
+#
+# Relevant mailing list thread:
+#
+# http://lists.gnu.org/archive/html/bug-tar/2016-05/msg00031.html
+
+AT_SETUP([xattrs: exclude xattrs on create ])
+AT_KEYWORDS([xattrs xattr06])
+
+AT_TAR_CHECK([
+AT_XATTRS_PREREQ
+
+mkdir dir
+mkdir output
+genfile --file dir/file
+
+for attr in excluded incla inclb inclc incl_excluded
+do
+ setfattr -n user.${attr} -v value dir/file || AT_SKIP_TEST
+done
+
+tar --xattrs-include=user.incl'*' --xattrs-exclude=user.incl_excluded -cf archive.tar -C dir .
+tar -xf archive.tar --xattrs-include=user.incl[[ab]] --xattrs-exclude=user.inclb -C output
+
+getfattr -d output/file | grep -v \
+ -e excluded \
+ -e inclb \
+ -e inclc > filtered
+getfattr -d output/file > full
+# if they differ then the attribute is still present
+diff filtered full
+],
+[0],
+[])
+
+AT_CLEANUP
--
2.9.3

View File

@ -1,215 +0,0 @@
From 6bd6bf244fb1b6bc07eb9cd1cd0bfdfd76576219 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Fri, 11 Nov 2016 12:30:35 +0200
Subject: [PATCH] don't set xattrs when --skip-old-files is used
* src/extract.c (set_xattr): Properly handle maybe_recoverable()
output. Throw warnings to not complicate caller.
(extract_file): Don't handle set_xattr's error.
* tests/xattr07.at: New testcase.
* tests/Makefile.am: Mention new testcase.
* tests/testsuite.at: Likewise.
* THANKS: Dawid.
Upstream commits 597b0ae509 and ca9399d4e.
---
THANKS | 1 +
src/extract.c | 41 +++++++++++++++++++-----------
tests/Makefile.am | 1 +
tests/testsuite.at | 1 +
tests/xattr07.at | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 102 insertions(+), 15 deletions(-)
create mode 100644 tests/xattr07.at
diff --git a/THANKS b/THANKS
index 3dda4cc..559f240 100644
--- a/THANKS
+++ b/THANKS
@@ -138,6 +138,7 @@ David Nugent davidn@blaze.net.au
David Shaw david.shaw@alcatel.com.au
David Steiner dsteiner@ispa.uni-osnabrueck.de
David Taylor taylor@think.com
+Dawid dpc@dpc.pw
Dean Gaudet dgaudet@watdragon.uwaterloo.ca
Demizu Noritoshi nori-d@is.aist-nara.ac.jp
Denis Excoffier denis.excoffier@free.fr
diff --git a/src/extract.c b/src/extract.c
index f982433..67885d7 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -795,13 +795,13 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
in advance dramatically improves the following performance of reading and
writing a file). If not restoring permissions, invert the INVERT_PERMISSIONS
bits from the file's current permissions. TYPEFLAG specifies the type of the
- file. FILE_CREATED indicates set_xattr has created the file */
+ file. Returns non-zero when error occurs (while un-available xattrs is not
+ an error, rather no-op). Non-zero FILE_CREATED indicates set_xattr has
+ created the file. */
static int
set_xattr (char const *file_name, struct tar_stat_info const *st,
mode_t invert_permissions, char typeflag, int *file_created)
{
- int status = 0;
-
#ifdef HAVE_XATTRS
bool interdir_made = false;
@@ -809,17 +809,32 @@ set_xattr (char const *file_name, struct tar_stat_info const *st,
{
mode_t mode = current_stat_info.stat.st_mode & MODE_RWX & ~ current_umask;
- do
- status = mknodat (chdir_fd, file_name, mode ^ invert_permissions, 0);
- while (status && maybe_recoverable ((char *)file_name, false,
- &interdir_made));
+ for (;;)
+ {
+ if (!mknodat (chdir_fd, file_name, mode ^ invert_permissions, 0))
+ {
+ /* Successfully created file */
+ xattrs_xattrs_set (st, file_name, typeflag, 0);
+ *file_created = 1;
+ return 0;
+ }
- xattrs_xattrs_set (st, file_name, typeflag, 0);
- *file_created = 1;
+ switch (maybe_recoverable ((char *)file_name, false, &interdir_made))
+ {
+ case RECOVER_OK:
+ continue;
+ case RECOVER_NO:
+ skip_member ();
+ open_error (file_name);
+ return 1;
+ case RECOVER_SKIP:
+ return 0;
+ }
+ }
}
#endif
- return(status);
+ return 0;
}
/* Fix the statuses of all directories whose statuses need fixing, and
@@ -1136,11 +1151,7 @@ extract_file (char *file_name, int typeflag)
int file_created = 0;
if (set_xattr (file_name, &current_stat_info, invert_permissions,
typeflag, &file_created))
- {
- skip_member ();
- open_error (file_name);
- return 1;
- }
+ return 1;
while ((fd = open_output_file (file_name, typeflag, mode,
file_created, &current_mode,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index abc17a4..4f3b918 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -243,6 +243,7 @@ TESTSUITE_AT = \
xattr04.at\
xattr05.at\
xattr06.at\
+ xattr07.at\
acls01.at\
acls02.at\
acls03.at\
diff --git a/tests/testsuite.at b/tests/testsuite.at
index db83c80..9493641 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -440,6 +440,7 @@ m4_include([xattr03.at])
m4_include([xattr04.at])
m4_include([xattr05.at])
m4_include([xattr06.at])
+m4_include([xattr07.at])
m4_include([acls01.at])
m4_include([acls02.at])
diff --git a/tests/xattr07.at b/tests/xattr07.at
new file mode 100644
index 0000000..a834981
--- /dev/null
+++ b/tests/xattr07.at
@@ -0,0 +1,73 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright 2011, 2013-2014, 2016 Free Software Foundation, Inc.
+
+# This file is part of GNU tar.
+
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Test description:
+# Test that --keep-old-files doesn't change xattrs of already existing file.
+# Per report:
+# https://lists.gnu.org/archive/html/bug-tar/2016-10/msg00001.html
+
+AT_SETUP([xattrs: xattrs and --skip-old-files])
+AT_KEYWORDS([xattrs xattr07])
+
+AT_TAR_CHECK([
+AT_XATTRS_PREREQ
+mkdir dir
+genfile --file dir/file
+genfile --file dir/file2
+
+setfattr -n user.test -v OurDirValue dir
+setfattr -n user.test -v OurFileValue dir/file
+setfattr -n user.test -v OurFileValue dir/file2
+
+tar --xattrs --no-recursion -cf archive.tar dir dir/file dir/file2
+
+setfattr -n user.test -v OurDirValue2 dir
+setfattr -n user.test -v OurFileValue2 dir/file
+setfattr -n user.test -v OurFileValue2 dir/file2
+
+# Check that tar continues to file2 too!
+tar --xattrs -xvf archive.tar --skip-old-files
+tar --xattrs -xvf archive.tar --keep-old-files
+
+getfattr -h -d dir | grep -v -e '^#' -e ^$
+getfattr -h -d dir/file | grep -v -e '^#' -e ^$
+getfattr -h -d dir/file2 | grep -v -e '^#' -e ^$
+],
+[0],
+[dir/
+dir/file
+dir/file2
+dir/
+dir/file
+dir/file2
+user.test="OurDirValue2"
+user.test="OurFileValue2"
+user.test="OurFileValue2"
+], [tar: dir: skipping existing file
+tar: dir/file: skipping existing file
+tar: dir/file: skipping existing file
+tar: dir/file2: skipping existing file
+tar: dir/file2: skipping existing file
+tar: dir/file: Cannot open: File exists
+tar: dir/file2: Cannot open: File exists
+tar: Exiting with failure status due to previous errors
+])
+
+AT_CLEANUP
--
2.9.3

View File

@ -4,9 +4,9 @@
Summary: A GNU file archiving program
Name: tar
Epoch: 2
Version: 1.29
Release: 7%{?dist}
Epoch: 1
Version: 1.30
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/
@ -19,12 +19,8 @@ Patch1: tar-1.28-loneZeroWarning.patch
Patch2: tar-1.28-vfatTruncate.patch
Patch3: tar-1.29-wildcards.patch
Patch4: tar-1.28-atime-rofs.patch
Patch5: tar-1.28-update-with-change-directory.patch
Patch9: tar-1.28-document-exclude-mistakes.patch
Patch11: tar-1.28-sparse-inf-loops.patch
Patch12: tar-1.29-create-and-xattrs-exclude.patch
Patch13: tar-1.29-xattrs-and-skip-old-files.patch
Patch14: tar-1.29-add-file-option.patch
# run "make check" by default
%bcond_without check
@ -124,6 +120,10 @@ fi
%{_infodir}/tar.info*
%changelog
* Mon Dec 18 2017 Pavel Raiskup <praiskup@redhat.com> - 1.30-1
- rebase to latest upstream release, per release notes
http://lists.gnu.org/archive/html/info-gnu/2017-12/msg00011.html
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.29-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild