rebase to new upstream release

Per release notes:
https://savannah.gnu.org/forum/forum.php?forum_id=8545

Resolves: rhbz#1336607
Version: 1.29-1
This commit is contained in:
Pavel Raiskup 2016-05-17 06:11:59 +02:00
parent b1611038b8
commit b8c4a6f530
9 changed files with 10 additions and 1114 deletions

4
.gitignore vendored
View File

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

View File

@ -1,2 +1,2 @@
49b6306167724fe48f419a33a5beb857 tar-1.28.tar.xz
a84d018c092514a65ba1c270a68826c3 tar-1.28.tar.xz.sig
a1802fec550baaeecff6c381629653ef tar-1.29.tar.xz
34219e18adf27b7b0ce3548013ec09d8 tar-1.29.tar.xz.sig

View File

@ -1,283 +0,0 @@
From: Sergey Poznyakoff <gray@gnu.org.ua>
Date: Fri, 26 Jun 2015 13:59:35 +0200
Subject: [PATCH 10/10] Bugfix: entries read from the -T file did not get
proper matching_flag.
(upstream commit 163e96a0e619a900eab6de827c7c5749ecc9d3f2)
Resolves: #1230762
diff --git a/src/common.h b/src/common.h
index edf787c..3cc2011 100644
--- a/src/common.h
+++ b/src/common.h
@@ -725,7 +725,7 @@ int uname_to_uid (char const *uname, uid_t *puid);
void name_init (void);
void name_add_name (const char *name, int matching_flags);
void name_add_dir (const char *name);
-void name_add_file (const char *name, int term);
+void name_add_file (const char *name, int term, int matching_flags);
void name_term (void);
const char *name_next (int change_dirs);
void name_gather (void);
diff --git a/src/names.c b/src/names.c
index fe3bcad..7c79a00 100644
--- a/src/names.c
+++ b/src/names.c
@@ -258,6 +258,21 @@ name_elt_alloc (void)
return elt;
}
+static struct name_elt *
+name_elt_alloc_matflags (int matflags)
+{
+ static int prev_flags = 0; /* FIXME: Or EXCLUDE_ANCHORED? */
+ struct name_elt *ep = name_elt_alloc ();
+ if (prev_flags != matflags)
+ {
+ ep->type = NELT_FMASK;
+ ep->v.matching_flags = matflags;
+ prev_flags = matflags;
+ ep = name_elt_alloc ();
+ }
+ return ep;
+}
+
static void
name_list_adjust (void)
{
@@ -276,20 +291,13 @@ name_list_advance (void)
free (elt);
}
-/* Add to name_array the file NAME with fnmatch options MATCHING_FLAGS */
+
+/* Add to name_array the file NAME with fnmatch options MATFLAGS */
void
-name_add_name (const char *name, int matching_flags)
+name_add_name (const char *name, int matflags)
{
- static int prev_flags = 0; /* FIXME: Or EXCLUDE_ANCHORED? */
- struct name_elt *ep = name_elt_alloc ();
+ struct name_elt *ep = name_elt_alloc_matflags (matflags);
- if (prev_flags != matching_flags)
- {
- ep->type = NELT_FMASK;
- ep->v.matching_flags = matching_flags;
- prev_flags = matching_flags;
- ep = name_elt_alloc ();
- }
ep->type = NELT_NAME;
ep->v.name = name;
name_count++;
@@ -305,9 +313,10 @@ name_add_dir (const char *name)
}
void
-name_add_file (const char *name, int term)
+name_add_file (const char *name, int term, int matflags)
{
- struct name_elt *ep = name_elt_alloc ();
+ struct name_elt *ep = name_elt_alloc_matflags (matflags);
+
ep->type = NELT_FILE;
ep->v.file.name = name;
ep->v.file.term = term;
@@ -389,6 +398,15 @@ add_file_id (const char *filename)
file_id_list = p;
return 0;
}
+
+/* Chop trailing slashes. */
+static void
+chopslash (char *str)
+{
+ char *p = str + strlen (str) - 1;
+ while (p > str && ISSLASH (*p))
+ *p-- = '\0';
+}
enum read_file_list_state /* Result of reading file name from the list file */
{
@@ -428,7 +446,7 @@ read_name_from_file (struct name_elt *ent)
if (counter == name_buffer_length)
name_buffer = x2realloc (name_buffer, &name_buffer_length);
name_buffer[counter] = 0;
-
+ chopslash (name_buffer);
return (counter == 0 && c == EOF) ? file_list_end : file_list_success;
}
@@ -518,7 +536,6 @@ copy_name (struct name_elt *ep)
{
const char *source;
size_t source_len;
- char *cursor;
source = ep->v.name;
source_len = strlen (source);
@@ -536,11 +553,7 @@ copy_name (struct name_elt *ep)
name_buffer = xmalloc(name_buffer_length + 2);
}
strcpy (name_buffer, source);
-
- /* Zap trailing slashes. */
- cursor = name_buffer + strlen (name_buffer) - 1;
- while (cursor > name_buffer && ISSLASH (*cursor))
- *cursor-- = '\0';
+ chopslash (name_buffer);
}
@@ -553,7 +566,8 @@ static int matching_flags; /* exclude_fnmatch options */
the request to change to the given directory.
Entries of type NELT_FMASK cause updates of the matching_flags
- value. */
+ value.
+*/
static struct name_elt *
name_next_elt (int change_dirs)
{
diff --git a/src/tar.c b/src/tar.c
index 79b0a10..6fa43d1 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -1640,7 +1640,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
case 'T':
- name_add_file (arg, filename_terminator);
+ name_add_file (arg, filename_terminator, MAKE_INCL_OPTIONS (args));
/* Indicate we've been given -T option. This is for backward
compatibility only, so that `tar cfT archive /dev/null will
succeed */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2a2e1cc..fc06c3b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -43,6 +43,8 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
TESTSUITE_AT = \
T-cd.at\
+ T-dir00.at\
+ T-dir01.at\
T-empty.at\
T-null.at\
T-rec.at\
diff --git a/tests/T-dir00.at b/tests/T-dir00.at
new file mode 100644
index 0000000..7f89fcf
--- /dev/null
+++ b/tests/T-dir00.at
@@ -0,0 +1,45 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright 2014 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/>.
+
+# Tar 1.27 and 1.28 did not extract files under directory memberes listed
+# in the file read by --file-from.
+#
+# Reported-by: Jean-Louis Martineau <martineau@zmanda.com>
+# References: <541AE02C.2050008@zmanda.com>,
+# http://lists.gnu.org/archive/html/bug-tar/2014-09/msg00006.html
+
+AT_SETUP([recursive extraction from --files-from])
+AT_KEYWORDS([files-from extract T-dir T-dir00])
+AT_TAR_CHECK([
+mkdir dir
+genfile -f dir/file1
+genfile -f dir/file2
+tar cf archive dir
+rm -rf dir
+echo dir > list
+tar xfTv archive list
+],
+[0],
+[dir/
+dir/file1
+dir/file2
+])
+AT_CLEANUP
+
diff --git a/tests/T-dir01.at b/tests/T-dir01.at
new file mode 100644
index 0000000..155a373
--- /dev/null
+++ b/tests/T-dir01.at
@@ -0,0 +1,45 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright 2014 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/>.
+
+# Tar 1.27 and 1.28 did not remove trailing slashes from file names
+# obtained with the --file-from option.
+#
+# Reported-by: Jean-Louis Martineau <martineau@zmanda.com>
+# References: <541AE02C.2050008@zmanda.com>,
+# http://lists.gnu.org/archive/html/bug-tar/2014-09/msg00006.html
+
+AT_SETUP([trailing slash in --files-from])
+AT_KEYWORDS([files-from extract T-dir T-dir01])
+AT_TAR_CHECK([
+mkdir dir
+genfile -f dir/file1
+genfile -f dir/file2
+tar cf archive dir
+rm -rf dir
+echo dir/ > list
+tar xfTv archive list
+],
+[0],
+[dir/
+dir/file1
+dir/file2
+])
+AT_CLEANUP
+
diff --git a/tests/testsuite.at b/tests/testsuite.at
index f1ce58f..789f16c 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -205,6 +205,8 @@ m4_include([T-empty.at])
m4_include([T-null.at])
m4_include([T-zfile.at])
m4_include([T-nonl.at])
+m4_include([T-dir00.at])
+m4_include([T-dir01.at])
AT_BANNER([Various options])
m4_include([indexfile.at])

View File

@ -1,157 +0,0 @@
From: rpm-build <rpm-build>
Date: Fri, 26 Jun 2015 14:10:30 +0200
Subject: [PATCH 11/11] tests: better test --{,no-}recursion options
Downstream patch, proposed:
http://www.mail-archive.com/bug-tar@gnu.org/msg04803.html
Related: #1230762
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fc06c3b..670291b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -48,6 +48,7 @@ TESTSUITE_AT = \
T-empty.at\
T-null.at\
T-rec.at\
+ T-recurse.at\
T-zfile.at\
T-nonl.at\
T-mult.at\
diff --git a/tests/T-recurse.at b/tests/T-recurse.at
new file mode 100644
index 0000000..7d5efe8
--- /dev/null
+++ b/tests/T-recurse.at
@@ -0,0 +1,96 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+
+# Test suite for GNU tar.
+# Copyright 2015 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/>.
+
+# Description: Test interaction of --recursion and --no-recursion options
+# together with --files-from option. This is complementary to recurs02.at test
+# case. References:
+# <alpine.LSU.2.11.1502201029580.29773@nerf60.vanv.qr>
+# http://lists.gnu.org/archive/html/bug-tar/2015-06/msg00006.html
+
+AT_SETUP([files-from & recurse: toggle])
+AT_KEYWORDS([recurse T-recurse files-from])
+
+AT_TAR_CHECK([
+mkdir directory1 directory2
+touch directory1/file directory2/file
+
+AT_DATA([F1],[--no-recursion
+directory1/
+--recursion
+directory2/
+])
+
+AT_DATA([F2A],[directory1/
+])
+
+AT_DATA([F2B],[directory2/
+])
+
+a=archive
+tar cf "$a" --files-from F1
+tar tf "$a"
+
+a=archive2
+tar cf "$a" --no-recursion -T F2A --recursion -T F2B
+tar tf "$a"
+],
+[0],
+[directory1/
+directory2/
+directory2/file
+directory1/
+directory2/
+directory2/file
+])
+
+AT_CLEANUP
+
+# Tar is not yet ready to properly handle --{,no-}recursion options if those are
+# set both as program arguments and from within --files-from file. The problem
+# is that content of -T argument is parsed too late; solution to this would
+# require additional NELT_* type implemented to allow handling of --recursion
+# option similarly to how the -C option is processed now.
+
+AT_SETUP([toggle --recursion (not) from -T])
+AT_KEYWORDS([recurse T-recurse T-recurse2 files-from])
+
+AT_TAR_CHECK([
+mkdir directory1 directory2
+touch directory1/file directory2/file
+
+AT_DATA([F1],[--no-recursion
+directory1/
+])
+
+AT_DATA([F2],[directory2/
+])
+
+tar cf archive -T F1 --recursion -T F2
+tar tf archive
+
+AT_XFAIL_IF([true])
+],
+[0],
+[directory1/
+directory2/
+directory2/file
+])
+
+AT_CLEANUP
diff --git a/tests/recurs02.at b/tests/recurs02.at
index 93aa2c1..00e1d66 100644
--- a/tests/recurs02.at
+++ b/tests/recurs02.at
@@ -37,11 +37,18 @@ tar --create --file archive \
--no-recursion directory1 \
--recursion directory2 || exit 1
tar tf archive
+tar cf archive directory1 directory2
+tar tf archive \
+ --no-recursion directory1 \
+ --recursion directory2 || exit 1
],
[0],
[directory1/
directory2/
directory2/file
+directory1/
+directory2/
+directory2/file
])
AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 789f16c..e3da356 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -200,6 +200,7 @@ AT_BANNER([The -T option])
m4_include([T-mult.at])
m4_include([T-nest.at])
m4_include([T-rec.at])
+m4_include([T-recurse.at])
m4_include([T-cd.at])
m4_include([T-empty.at])
m4_include([T-null.at])

View File

@ -1,47 +0,0 @@
From: Pavel Raiskup <praiskup@redhat.com>
Date: Wed, 17 Dec 2014 07:22:28 +0100
Subject: [PATCH 12/12] testsuite: sort (otherwise random) expected output
Downstream, proposed:
http://www.mail-archive.com/bug-tar@gnu.org/msg04798.html
diff --git a/tests/T-dir00.at b/tests/T-dir00.at
index 7f89fcf..8ff6ba8 100644
--- a/tests/T-dir00.at
+++ b/tests/T-dir00.at
@@ -28,13 +28,14 @@
AT_SETUP([recursive extraction from --files-from])
AT_KEYWORDS([files-from extract T-dir T-dir00])
AT_TAR_CHECK([
+AT_SORT_PREREQ
mkdir dir
genfile -f dir/file1
genfile -f dir/file2
tar cf archive dir
rm -rf dir
echo dir > list
-tar xfTv archive list
+tar xfTv archive list | sort
],
[0],
[dir/
diff --git a/tests/T-dir01.at b/tests/T-dir01.at
index 155a373..db92292 100644
--- a/tests/T-dir01.at
+++ b/tests/T-dir01.at
@@ -28,13 +28,14 @@
AT_SETUP([trailing slash in --files-from])
AT_KEYWORDS([files-from extract T-dir T-dir01])
AT_TAR_CHECK([
+AT_SORT_PREREQ
mkdir dir
genfile -f dir/file1
genfile -f dir/file2
tar cf archive dir
rm -rf dir
echo dir/ > list
-tar xfTv archive list
+tar xfTv archive list | sort
],
[0],
[dir/

View File

@ -1,123 +0,0 @@
From 6400976234810f4de138ee692756072f5beaa64d Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Mon, 28 Jul 2014 08:18:53 +0200
Subject: [PATCH 9/9] --posix & big (effective) sparse files can not be listed
Upstram bugreports (still downstream):
http://www.mail-archive.com/bug-tar%40gnu.org/msg03909.html
http://www.mail-archive.com/bug-tar@gnu.org/msg04489.html
Related: #916995
---
src/list.c | 1 -
src/sparse.c | 4 ++--
src/tar.h | 4 ++++
src/xheader.c | 28 +++++++++++++++++++++++++++-
4 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/src/list.c b/src/list.c
index 0c7a740..ce9ce4b 100644
--- a/src/list.c
+++ b/src/list.c
@@ -700,7 +700,6 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
}
}
- stat_info->archive_file_size = stat_info->stat.st_size;
xheader_decode (stat_info);
if (sparse_member_p (stat_info))
diff --git a/src/sparse.c b/src/sparse.c
index 53c1868..c8bec6b 100644
--- a/src/sparse.c
+++ b/src/sparse.c
@@ -892,7 +892,7 @@ static struct tar_sparse_optab const star_optab = {
* 1.0
Starting from this version, the exact sparse format version is specified
- explicitely in the header using the following variables:
+ explicitly in the header using the following variables:
GNU.sparse.major Major version
GNU.sparse.minor Minor version
@@ -921,7 +921,7 @@ static struct tar_sparse_optab const star_optab = {
directory. Then, using a simple program it would be possible to expand the
file to its original form even without GNU tar.
- Bu default, v.1.0 archives are created. To use other formats,
+ By default, v.1.0 archives are created. To use other formats,
--sparse-version option is provided. Additionally, v.0.0 can be obtained
by deleting GNU.sparse.map from 0.1 format: --sparse-version 0.1
--pax-option delete=GNU.sparse.map
diff --git a/src/tar.h b/src/tar.h
index 3d69399..73cd11e 100644
--- a/src/tar.h
+++ b/src/tar.h
@@ -327,6 +327,10 @@ struct tar_stat_info
size_t sparse_map_size; /* Size of the sparse map */
struct sp_array *sparse_map;
+ off_t real_size; /* The real size of sparse file */
+ int real_size_set; /* True when GNU.sparse.realsize is set in
+ archived file */
+
size_t xattr_map_size; /* Size of the xattr map */
struct xattr_array *xattr_map;
diff --git a/src/xheader.c b/src/xheader.c
index c94c6d3..0be83a4 100644
--- a/src/xheader.c
+++ b/src/xheader.c
@@ -742,6 +742,20 @@ decx (void *data, char const *keyword, char const *value, size_t size)
keyword));
}
+static void
+xheader_fixup_file_size (struct tar_stat_info *st)
+{
+ /* The effective size is in st_size, regardless of whether the file is sparse
+ * or not. */
+ st->archive_file_size = st->stat.st_size;
+
+ /* For non-sparse files we are done (effective size == real size). But for
+ sparse files we must take the GNU.sparse.realsize header into account (if
+ present, its content was parsed by sparse_size_decoder already. */
+ if (st->real_size_set)
+ st->stat.st_size = st->real_size;
+}
+
void
xheader_decode (struct tar_stat_info *st)
{
@@ -755,6 +769,11 @@ xheader_decode (struct tar_stat_info *st)
continue;
}
run_override_list (keyword_override_list, st);
+
+ /* Here we know for sure that we have "effective" size stored into
+ st->stat->st_size (this may be set by read_header directly from regular pax
+ header, or overwritten by size_decoder() from extended pax header). */
+ xheader_fixup_file_size (st);
}
static void
@@ -1360,7 +1379,14 @@ sparse_size_decoder (struct tar_stat_info *st,
{
uintmax_t u;
if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), keyword))
- st->stat.st_size = u;
+ {
+ /* do not set the st->stat.st_size here immediately because there may be
+ the 'size' extended header following 'GNU.sparse.realsize' which would
+ override our setup. We must handle size (and real size) of sparse
+ files once whole xheader is read */
+ st->real_size_set = 1;
+ st->real_size = u;
+ }
}
static void
--
1.9.3

View File

@ -1,380 +0,0 @@
From 914bb84cb71ebb63c40bc27f4d017cc0a0a39bf2 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 28 Jul 2014 08:15:14 +0200
Subject: [PATCH 6/9] Add documentation which was not yet pushed upstream
Upstream bugreport:
http://lists.gnu.org/archive/html/bug-tar/2012-08/msg00012.html
http://www.mail-archive.com/bug-tar@gnu.org/msg04135.html
Related: #996753
---
doc/tar.texi | 276 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 276 insertions(+)
diff --git a/doc/tar.texi b/doc/tar.texi
index db79824..a000f3f 100644
--- a/doc/tar.texi
+++ b/doc/tar.texi
@@ -161,6 +161,7 @@ How to Create Archives
How to List Archives
* list dir::
+* List Extended Attributes::
How to Extract Members from an Archive
@@ -1491,6 +1492,7 @@ for a detailed discussion of globbing patterns and related
@menu
* list dir::
+* List Extended Attributes::
@end menu
@node list dir
@@ -1521,6 +1523,116 @@ drwxrwxrwx myself/user 0 1990-05-31 21:49 practice/
When you use a directory name as a file name argument, @command{tar} acts on
all the files (including sub-directories) in that directory.
+@node List Extended Attributes
+@unnumberedsubsec Listing xattrs, POSIX ACLs and SELinux context
+
+From upstream GNU tar 1.26.9, tar is able to store, extract and list extended
+file attributes. Listing of those attributes is then active only in verbose and
+double-verbose mode.
+
+This section exercises how to list attributes on examples. Lets start with
+simple verbose mode. This output is inspired by GNU @command{ls -l} command
+output.
+
+@itemize @bullet
+@item
+Show only pure extended attributes.
+
+@smallexample
+$ tar --xattrs --list -v archive.tar
+-rw-rwxr-- user/group 0 2012-08-08 15:15 acls.txt
+-rw-rw-r--* user/group 0 2012-08-08 15:15 xattrs.txt
+@end smallexample
+
+Note the asterisk on the third line! It reflects the situation that the file
+'xattrs.txt' has some extended attribute set. The default mode (same as if you
+are extracting extended attributes) shows information only about extended
+attributes from 'user.*' domain. Anyway, feel free to change the sensitivity
+using @option{--xattrs-include} or @option{--xattrs-exclude} options.
+
+@item Show only POSIX ACLs - the character you should look for is '+':
+
+@smallexample
+$ tar --acls --list -v archive.tar
+-rw-rwxr--+ praiskup/praiskup 0 2012-08-08 15:15 acls.txt
+-rw-rw-r-- praiskup/praiskup 0 2012-08-08 15:15 xattrs.txt
+@end smallexample
+
+@item Show only SELinux - the key character is '.':
+
+@smallexample
+$ tar --selinux --list -v archive.tar
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:16 selinux_only.txt
+-rw-rw-r-- praiskup/praiskup 0 2012-08-08 15:15 xattrs.txt
+@end smallexample
+
+@item
+Show info about ACLs, SELinux and general extended attributes together:
+
+@smallexample
+$ tar --selinux --acls --xattrs --list -v archive.tar
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:16 selinux_only.txt
+-rw-rwxr--+ praiskup/praiskup 0 2012-08-08 15:15 acls.txt
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:15 xattrs.txt
+@end smallexample
+
+In this case, the priority of character is '+' > '.' > '*'. You don't see the
+general extended attributes flag ('*' character) on this example because it is
+hidden by '.' (meaning that the file has SELinux context set).
+
+@end itemize
+
+The example of double verbose mode is here. In this output the single verbose
+characters '.', '+' and '*' are also present after the permission string.
+
+@smallexample
+$ tar --xattrs --selinux --acls -tvvf archive.tar
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:16 selinux_only.txt
+ s: unconfined_u:object_r:user_tmp_t:s0
+-rw-rwxr--+ praiskup/praiskup 0 2012-08-08 15:15 acls.txt
+ s: unconfined_u:object_r:user_tmp_t:s0
+ a: user::rw-,user:tester:rwx,group::rw-,mask::rwx,other::r--
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:15 xattrs.txt
+ s: unconfined_u:object_r:user_tmp_t:s0
+ x: 12 user.xattr
+ x: 12 user.we_like_tar
+@end smallexample
+
+This mode extends tar's output with additional lines beginning with
+distinguishing characters - 's' for SELinux context, 'a' for POSIX Access
+Control Lists and 'x' for generic extended attributes.
+
+In this format, POSIX ACLs are written in SHORT TEXT FORM as specified in manual
+page @command{man 5 acl}.
+
+Use the @option{--xattrs-include} again if you want to print other than default
+'user.*' extended attributes domain:
+
+@smallexample
+$ tar --xattrs --xattrs-include='*' --acls --selinux -tvvf archive.tar
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:16 selinux_only.txt
+ s: unconfined_u:object_r:user_tmp_t:s0
+ x: 36 security.selinux
+-rw-rwxr--+ praiskup/praiskup 0 2012-08-08 15:15 acls.txt
+ s: unconfined_u:object_r:user_tmp_t:s0
+ a: user::rw-,user:tester:rwx,group::rw-,mask::rwx,other::r--
+ x: 36 security.selinux
+ x: 44 system.posix_acl_access
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:15 xattrs.txt
+ s: unconfined_u:object_r:user_tmp_t:s0
+ x: 36 security.selinux
+ x: 12 user.xattr
+ x: 12 user.we_like_tar
+@end smallexample
+
+As is in @pxref{Option Summary} section described, tar by default stores all
+extended attributes that are available (not only 'user.*' domain). It means
+that the SELinux context and POSIX ACLs (because they are implemented using the
+generic extended attributes on usual file system) may be stored twice sometimes
+-- firstly in "raw" file system binary format and secondly in more portable way
+-- using appropriate system calls (invoked by @command{tar} options
+@option{--selinux} and @option{--acls}).
+
@node extract
@section How to Extract Members from an Archive
@cindex Extraction
@@ -2368,6 +2480,10 @@ Normally when creating an archive, @command{tar} strips an initial
treats names specially if they have initial @samp{/} or internal
@samp{..}. This option disables that behavior. @xref{absolute}.
+@opsummary{acls}
+@item --acls
+Causes @command{tar} to store/restore/list POSIX ACL's. @xref{Attributes}.
+
@opsummary{after-date}
@item --after-date
@@ -2953,6 +3069,11 @@ contents have changed (as opposed to just @option{--newer}, which will
also back up files for which any status information has
changed). @xref{after}.
+@opsummary{no-acls}
+@item --no-acls
+Causes @command{tar} not to store, extract or list POSIX ACL's.
+@xref{Attributes}.
+
@opsummary{no-anchored}
@item --no-anchored
An exclude pattern can match any subsequence of the name's components.
@@ -3036,11 +3157,20 @@ locations. Usually @command{tar} determines automatically whether
the archive can be seeked or not. Use this option to disable this
mechanism.
+@opsummary{no-selinux}
+@item --no-selinux
+Causes @command{tar} not to store, extract or list SELinux security context.
+@xref{Attributes}.
+
@opsummary{no-unquote}
@item --no-unquote
Treat all input file or member names literally, do not interpret
escape sequences. @xref{input name quoting}.
+@opsummary{no-xattrs}
+@item --no-xattrs
+Causes @command{tar} not to store, extract or list xattrs. @xref{Attributes}.
+
@opsummary{no-wildcards}
@item --no-wildcards
Do not use wildcards.
@@ -3286,6 +3416,11 @@ in cases when such recognition fails. It takes effect only if the
archive is open for reading (e.g. with @option{--list} or
@option{--extract} options).
+@opsummary{selinux}
+@item --selinux
+Causes @command{tar} to store, extract or list SELinux security context.
+@xref{Attributes}.
+
@opsummary{show-defaults}
@item --show-defaults
@@ -3541,6 +3676,11 @@ Enable or disable warning messages identified by @var{keyword}. The
messages are suppressed if @var{keyword} is prefixed with @samp{no-}.
@xref{warnings}.
+@opsummary{xattrs}
+@item --xattrs
+Causes @command{tar} to store, restore or list extended file attributes. For
+more info see @xref{Attributes}.
+
@opsummary{wildcards}
@item --wildcards
Use wildcards when matching member names with patterns.
@@ -4363,6 +4503,11 @@ failed, switched to @command{gzip}.
@cindex @samp{Record size = %lu blocks}, warning message
@item record-size
@samp{Record size = %lu blocks}
+@kwindex xattr-write
+@item xattr-write
+@samp{%s: Cannot set '%s' extended attribute for file '%s'}
+@*@samp{%s: Cannot set POSIX ACLs for file '%s'}
+@*@samp{%s: Cannot set SELinux context for file '%s'}
@end table
@subheading Keywords controlling incremental extraction:
@@ -8968,6 +9113,8 @@ implementation able to read @samp{ustar} archives will be able to read
most @samp{posix} archives as well, with the only exception that any
additional information (such as long file names etc.) will in such
case be extracted as plain text files along with the files it refers to.
+This is the only format that can store ACLs, SELinux context and extended
+attributes.
This archive format will be the default format for future versions
of @GNUTAR{}.
@@ -9607,6 +9754,135 @@ Same as both @option{--same-permissions} and @option{--same-order}.
This option is deprecated, and will be removed in @GNUTAR{} version 1.23.
+@opindex xattrs
+@item --xattrs
+This option causes @command{tar} to store, restore or list the extended file
+attributes (for information about extended attributes see @command{man(5)
+attr}).
+
+Note that all extended attributes are stored "as-is" (in file system binary
+format) and the resulting archive may be not fully portable. See the
+@option{--selinux} and @option{--acls} options when you want to deal with these
+types of extended attributes in a better way.
+
+The @option{--xattrs} option implies the option @option{--format=posix} when
+tar is in @option{--create} operation mode. It is the only one format which
+hase usable headers for storing additional file information like extended
+attributes are.
+
+By default, all extended attributes are stored into the archive. The reason is
+that we want to make the backup process as complete as possible by default. On
+the other hand, during extracting only the 'user.*' domain is extracted by
+default. Anyway, this default behaviour may be easily modified by the
+@option{--xattrs-include} and @option{--xattrs-exclude} options.
+
+When you list an archive in verbose mode
+(@command{tar --xattrs --verbose -tf archive.tar}), tar shows the '*' character
+after the permissions string of concrete file ringht to tell you that at least
+one extended attribute is stored with corresponding file.
+
+Double verbose mode (@command{tar --xattrs -tvvf archive.tar}) prints the
+extended attribute length (in bytes) and its ASCII key (for printed examples
+@pxref{List Extended Attributes}).
+
+@option{--xattrs} option has no equivalent short option.
+
+Warnings which occur during impossible writing of extended attributes to
+a file system may be suppressed using the @option{--warning=no-xattr-write}
+option.
+
+@opindex no-xattrs
+@item --no-xattrs
+This option causes @command{tar} not to store/extract or list the current
+extended attributes. This option does not affect options @option{--no-selinux}
+or @option{--no-acls}.
+
+The @option{--no-xattrs} option has no equivalent short option name.
+
+@opindex xattrs-include
+@opindex xattrs-exclude
+@item --xattrs-include=MASK
+@itemx --xattrs-exclude=MASK
+
+These options allows the xattr store/restore/list process to be more fine
+grained. The default configuration is that @option{--create} mode handles all
+available extended attributes and the @option{--extract}/@option{--list} mode
+handles only 'user.*' domain. These options may be used for editing of this
+default behaviour.
+
+@itemize @bullet
+@item
+Lets say we want to store all attributes except some "public restricted" domain
+(e.g. 'user.restricted.*' domain. The correct way how to do it is:
+
+@command{tar --xattrs --xattrs-include='*' --xattrs-exclude='user.restricted.*'
+-cf archive.tar FILES}
+@item
+And, when we want to extract only some specific domain from an archive - we can
+use:
+
+@command{tar --xattrs --xattrs-include='security.capability' -xf archive.tar
+FILES}
+@end itemize
+
+Multiple passed include/exclude patterns are combined together. The attribute
+is covered then only if (1) at least one of all include patterns matches its
+keyword and (2) no exclude pattern matches its keyword.
+
+When only include pattern is set - exclude pattern is left in default mode (and
+vice versa).
+
+@opindex selinux
+@item --selinux
+This option causes @command{tar} to store/extract/list the SELinux context
+information into/from an archive. Command @command{tar} is able to show info
+whether the SELinux context is present in archived file using the verbose
+listing mode (@command{tar --selinux -tvf archive.tar}). It shows the '.'
+character after permission string in that case. Double-verbose listing mode
+(@command{tar -tvvf archive.tar}) then prints the full SELinux context to
+standard output, @pxref{List Extended Attributes} for printed example.
+
+This option implies the @option{--format=posix} when @command{tar} works in
+@option{--create} operation mode.
+
+Warnings complaining that SELinux context may not be written to a file system
+may be suppressed by the @option{--warning=no-xattr-write} option.
+
+The @option{--selinux} option has no equivalent short option name.
+
+@opindex no-selinux
+@item --no-selinux
+This option causes @command{tar} not to store the current SELinux security
+context information in the archive and not to extract any SELinux information in
+an archive.
+
+The @option{--no-selinux} option has no equivalent short option name.
+
+@opindex acls
+@item --acls
+This option causes @command{tar} to store the current POSIX access control lists
+into the archive or restore POSIX ACLs from an archive. It also allows
+@command{tar} to show whether archived file contains ACLs when the verbose mode
+is active (@option{tar --acls -tvf} shows the symbol '+' after the permission
+characters in that case). Double-verbose mode allows @command{tar} to list
+contained POSIX ACLs (@command{tar --acls -tvvf archive.tar}), for printed
+examples @pxref{List Extended Attributes}.
+
+This option implies the @option{--format=posix} when @command{tar} works in
+@option{--create} operation mode.
+
+Warnings complaining that POSIX ACLs may not be written to a file system may be
+suppressed by the @option{--warning=no-xattr-write} option.
+
+The @option{--acls} option has no equivalent short form.
+
+@opindex no-acls
+@item --no-acls
+This option causes @command{tar} not to store the current POSIX ACL into the
+archive and not to extract any POSIX ACL information from an archive.
+
+The @option{--no-acls} option has no equivalent short option name.
+
@end table
@node Portability
--
1.9.3

View File

@ -1,112 +0,0 @@
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

View File

@ -4,8 +4,8 @@
Summary: A GNU file archiving program
Name: tar
Epoch: 2
Version: 1.28
Release: 7%{?dist}
Version: 1.29
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/
@ -16,16 +16,11 @@ Source1: ftp://ftp.gnu.org/pub/gnu/tar/tar-%{version}.tar.xz.sig
# Note that all patches are documented in patch files (git format-patch format)
Patch1: tar-1.28-loneZeroWarning.patch
Patch2: tar-1.28-vfatTruncate.patch
Patch3: tar-1.28-wildcards.patch
Patch3: tar-1.29-wildcards.patch
Patch4: tar-1.28-atime-rofs.patch
Patch5: tar-1.28-update-with-change-directory.patch
Patch7: tar-1.28-docu-xattrs.patch
Patch9: tar-1.28-document-exclude-mistakes.patch
Patch11: tar-1.28-sparse-inf-loops.patch
Patch12: tar-1.28-big-sparse-listing.patch
Patch13: tar-1.28-T-matchflags.patch
Patch14: tar-1.28-T-recursion-tests.patch
Patch15: tar-1.28-T-tests-false-failure.patch
# run "make check" by default
%bcond_without check
@ -119,6 +114,9 @@ fi
%{_infodir}/tar.info*
%changelog
* Tue May 17 2016 Pavel Raiskup <praiskup@redhat.com> - 1.29-1
- new upstream release 1.29 (rhbz#1336607)
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.28-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild