* [gentoo-commits] dev/blueness:master commit in: app-arch/tar/files/, app-arch/tar/
@ 2011-09-10 14:12 Anthony G. Basile
0 siblings, 0 replies; 4+ messages in thread
From: Anthony G. Basile @ 2011-09-10 14:12 UTC (permalink / raw
To: gentoo-commits
commit: 46a89135e66ff6652c2e39c442a6d2b9a8810df4
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 10 14:11:49 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Sep 10 14:11:49 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/blueness.git;a=commit;h=46a89135
app-arch/tar: testing for bug #382067
(Portage version: 2.1.10.11/git/Linux x86_64, unsigned Manifest commit)
---
app-arch/tar/ChangeLog | 8 +
app-arch/tar/Manifest | 7 +
app-arch/tar/files/rmt | 8 +
app-arch/tar/files/tar-1.26-xattr.patch | 1617 +++++++++++++++++++++++++++++++
app-arch/tar/files/tar.1 | 816 ++++++++++++++++
app-arch/tar/metadata.xml | 5 +
app-arch/tar/tar-1.26-r1.ebuild | 76 ++
7 files changed, 2537 insertions(+), 0 deletions(-)
diff --git a/app-arch/tar/ChangeLog b/app-arch/tar/ChangeLog
new file mode 100644
index 0000000..aee1458
--- /dev/null
+++ b/app-arch/tar/ChangeLog
@@ -0,0 +1,8 @@
+
+
+*tar-1.26 (10 Sep 2011)
+
+ 10 Sep 2011; Anthony G. Basile <blueness@gentoo.org> +tar-1.26-r1.ebuild,
+ +files/tar-1.26-xattrs.patch, +files/rmt, +files/tar.1:
+ Testing for bug #382067
+
diff --git a/app-arch/tar/Manifest b/app-arch/tar/Manifest
new file mode 100644
index 0000000..41c06a5
--- /dev/null
+++ b/app-arch/tar/Manifest
@@ -0,0 +1,7 @@
+AUX rmt 263 RMD160 c5d680ef166b8afda1e78cb5c7d1b47cdb6c99df SHA1 43b791b49aa06e151b90e8e91e3287af3259a62a SHA256 c0371cb0243a190b6bb43609c86dfb4cd637882d4ff3ff9651ca7ec8d6b59355
+AUX tar-1.26-xattr.patch 49745 RMD160 edf35cd3de8fbc65568abeb39b9adcc086b6b503 SHA1 6932ff1a0a47b524fa29b142717410c68f3bc455 SHA256 6ecbb2586db8937a03ddff393c79c0bdf070d2ecb264c704702da14e221eee9e
+AUX tar.1 16821 RMD160 f58bc7cfeeee0cc811a6c2b5dd1dffe8b197231e SHA1 b354f0803c03cd59fe24f93d532f27f6f0136316 SHA256 f3558b444ab9427c06bc92838c29194051ed64edd0a909163cfa715cc7e6dcdd
+DIST tar-1.26.tar.bz2 2339773 RMD160 d507dc5a57a823701cae5cdd2b98aba48ec74d3f SHA1 70f298c3cd997b694864c55e6d8655324c87a0cc SHA256 5a5369f464502a598e938029c310d4b3abd51e6bb8dfd045663e61c8ea9f6d41
+EBUILD tar-1.26-r1.ebuild 2199 RMD160 532becc5470d1ff8e32a46c525cdd0f0248766e7 SHA1 9cd1a2cac0016071c3db2ef0eb3ef8b5420a82d1 SHA256 ca32c2569b10eb144fca898628e97bfc71b6b50ac83bcc4a4baa98e791b8185a
+MISC ChangeLog 188 RMD160 374124449767f675e91ea3c68f2dc71cec08fef7 SHA1 52869a81915a74714731baa166bed134d339f359 SHA256 f9f1e2d644353c964bc1b57c48101e7d1f980e15a22e906dbbf66865eb4587d9
+MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92
diff --git a/app-arch/tar/files/rmt b/app-arch/tar/files/rmt
new file mode 100644
index 0000000..15ed6aa
--- /dev/null
+++ b/app-arch/tar/files/rmt
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# This is not a mistake. This shell script (/etc/rmt) has been provided
+# for compatibility with other Unix-like systems, some of which have
+# utilities that expect to find (and execute) rmt in the /etc directory
+# on remote systems.
+#
+exec rmt "$@"
diff --git a/app-arch/tar/files/tar-1.26-xattr.patch b/app-arch/tar/files/tar-1.26-xattr.patch
new file mode 100644
index 0000000..91d56ac
--- /dev/null
+++ b/app-arch/tar/files/tar-1.26-xattr.patch
@@ -0,0 +1,1617 @@
+diff -Naur tar-1.26.orig//configure.ac tar-1.26/configure.ac
+--- tar-1.26.orig//configure.ac 2011-03-12 04:47:13.000000000 -0500
++++ tar-1.26/configure.ac 2011-09-07 06:13:38.000000000 -0400
+@@ -44,7 +44,7 @@
+ sys/param.h sys/device.h sys/gentape.h \
+ sys/inet.h sys/io/trioctl.h \
+ sys/mtio.h sys/time.h sys/tprintf.h sys/tape.h \
+- unistd.h locale.h)
++ unistd.h locale.h attr/xattr.h sys/acl.h)
+
+ AC_CHECK_HEADERS([sys/buf.h], [], [],
+ [#if HAVE_SYS_PARAM_H
+@@ -91,6 +91,12 @@
+ tar_PAXUTILS
+
+ AC_CHECK_FUNCS_ONCE([fchmod fchown fsync lstat mkfifo readlink symlink])
++AC_CHECK_FUNCS(getxattr fgetxattr lgetxattr \
++ setxattr fsetxattr lsetxattr \
++ listxattr flistxattr llistxattr,
++ AC_DEFINE(HAVE_XATTRS,,[Define if we have a working extended attributes]),)
++AC_CHECK_LIB(acl, acl_get_fd)
++
+ AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
+ AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
+ AC_CHECK_DECLS([time],,, [#include <time.h>])
+@@ -214,6 +220,7 @@
+ # Iconv
+ AM_ICONV
+ AC_CHECK_HEADERS(iconv.h)
++AC_CHECK_HEADERS(attr/xattr.h)
+ AC_CHECK_TYPE(iconv_t,:,
+ AC_DEFINE(iconv_t, int,
+ [Conversion descriptor type]),
+@@ -223,6 +230,17 @@
+ #endif
+ ])
+
++AC_ARG_ENABLE(selinux,
++ AC_HELP_STRING([--enable-selinux],
++ [enable SELinux support (disabled by default)]),
++ [selinux_enabled=$enableval],
++ [selinux_enabled=no])
++
++if test "x$selinux_enabled" = xyes; then
++ AC_CHECK_LIB(selinux, getfilecon)
++ AC_CHECK_HEADERS(selinux/selinux.h)
++fi
++
+ # Gettext.
+ AM_GNU_GETTEXT([external], [need-formatstring-macros])
+ AM_GNU_GETTEXT_VERSION([0.16])
+diff -Naur tar-1.26.orig//doc/tar.texi tar-1.26/doc/tar.texi
+--- tar-1.26.orig//doc/tar.texi 2011-03-12 04:09:33.000000000 -0500
++++ tar-1.26/doc/tar.texi 2011-09-07 06:13:38.000000000 -0400
+@@ -2369,6 +2369,10 @@
+ @samp{/} from member names. This option disables that behavior.
+ @xref{absolute}.
+
++@opsummary{acl}
++@item --acls
++Causes @command{tar} to store ACL's. @xref{Attributes}.
++
+ @opsummary{after-date}
+ @item --after-date
+
+@@ -2914,6 +2918,10 @@
+ also back up files for which any status information has
+ changed). @xref{after}.
+
++@opsummary{no-acl}
++@item --no-acls
++Causes @command{tar} not to store and not to extract ACL's. @xref{Attributes}.
++
+ @opsummary{no-anchored}
+ @item --no-anchored
+ An exclude pattern can match any subsequence of the name's components.
+@@ -2997,11 +3005,21 @@
+ 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 and not to extract 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 and not to extract xattrs. This option also
++enables @option{--no-selinux} and @option{--no-acls}. @xref{Attributes}.
++
+ @opsummary{no-wildcards}
+ @item --no-wildcards
+ Do not use wildcards.
+@@ -3234,6 +3252,11 @@
+ archive is open for reading (e.g. with @option{--list} or
+ @option{--extract} options).
+
++@opsummary{selinux}
++@item --selinux
++Causes @command{tar} to store SElinux security context. @xref{Attributes}.
++
++
+ @opsummary{show-defaults}
+ @item --show-defaults
+
+@@ -3447,6 +3470,11 @@
+ messages are suppressed if @var{keyword} is prefixed with @samp{no-}.
+ @xref{warnings}.
+
++@opsummary{xattrs}
++@item --xattrs
++Causes @command{tar} to store xattrs. This option also enables
++@option{--selinux} and @option{--acls}. @xref{Attributes}.
++
+ @opsummary{wildcards}
+ @item --wildcards
+ Use wildcards when matching member names with patterns.
+@@ -8659,6 +8687,8 @@
+ 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{}.
+@@ -9293,6 +9323,51 @@
+
+ This option is deprecated, and will be removed in @GNUTAR{} version 1.23.
+
++@opindex acls
++@item --acls
++This option causes @command{tar} to store the current ACL in the archive.
++
++The @option{--acls} option has no equivalent short option name.
++
++@opindex selinux
++@item --selinux
++This option causes @command{tar} to store the current SELinux security context
++information in the archive.
++
++The @option{--selinux} option has no equivalent short option name.
++
++@opindex xattrs
++@item --xattrs
++This option causes @command{tar} to store the current extended attributes in
++the archive. This option also enables @option{--acls} and @option{--selinux} if
++they haven't been set already.
++
++The @option{--xattrs} option has no equivalent short option name.
++
++@opindex no-acls
++@item --no-acls
++This option causes @command{tar} not to store the current ACL in the archive
++and not to extract any ACL information in an archive.
++
++The @option{--no-acls} 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 no-xattrs
++@item --no-xattrs
++This option causes @command{tar} not to store the current extended attributes in
++the archive and not to extract any extended attributes in an archive. This
++option also enables @option{--no-acls} and @option{--no-selinux} if
++they haven't been set already.
++
++The @option{--no-xattrs} option has no equivalent short option name.
++
+ @end table
+
+ @node Portability
+diff -Naur tar-1.26.orig//src/common.h tar-1.26/src/common.h
+--- tar-1.26.orig//src/common.h 2011-02-11 06:56:13.000000000 -0500
++++ tar-1.26/src/common.h 2011-09-07 06:13:38.000000000 -0400
+@@ -253,6 +253,15 @@
+ /* If positive, preserve permissions when extracting. */
+ GLOBAL int same_permissions_option;
+
++/* If positive, save the SELinux context. */
++GLOBAL int selinux_context_option;
++
++/* If positive, save the ACLs. */
++GLOBAL int acls_option;
++
++/* If positive, save the user and root xattrs. */
++GLOBAL int xattrs_option;
++
+ /* When set, strip the given number of file name components from the file name
+ before extracting */
+ GLOBAL size_t strip_name_components;
+@@ -707,6 +716,9 @@
+
+ void update_archive (void);
+
++/* Module attrs.c. */
++#include "xattrs.h"
++
+ /* Module xheader.c. */
+
+ void xheader_decode (struct tar_stat_info *stat);
+@@ -727,6 +739,12 @@
+ bool xheader_keyword_deleted_p (const char *kw);
+ char *xheader_format_name (struct tar_stat_info *st, const char *fmt,
+ size_t n);
++void xheader_xattr_init(struct tar_stat_info *st);
++void xheader_xattr_free(struct xattr_array *vals, size_t sz);
++void xheader_xattr_copy(const struct tar_stat_info *st,
++ struct xattr_array **vals, size_t *sz);
++void xheader_xattr_add(struct tar_stat_info *st,
++ const char *key, const char *val, size_t len);
+
+ /* Module system.c */
+
+diff -Naur tar-1.26.orig//src/create.c tar-1.26/src/create.c
+--- tar-1.26.orig//src/create.c 2011-03-12 04:09:33.000000000 -0500
++++ tar-1.26/src/create.c 2011-09-07 06:13:38.000000000 -0400
+@@ -24,6 +24,7 @@
+ #include <quotearg.h>
+
+ #include "common.h"
++
+ #include <hash.h>
+
+ /* Error number to use when an impostor is discovered.
+@@ -936,6 +937,30 @@
+ GNAME_TO_CHARS (st->gname, header->header.gname);
+ }
+
++ if (archive_format == POSIX_FORMAT)
++ {
++ if (acls_option > 0)
++ {
++ if (st->acls_a_ptr)
++ xheader_store ("SCHILY.acl.access", st, NULL);
++ if (st->acls_d_ptr)
++ xheader_store ("SCHILY.acl.default", st, NULL);
++ }
++ if ((selinux_context_option > 0) && st->cntx_name)
++ xheader_store ("RHT.security.selinux", st, NULL);
++ if (xattrs_option > 0)
++ {
++ size_t scan_xattr = 0;
++ struct xattr_array *xattr_map = st->xattr_map;
++
++ while (scan_xattr < st->xattr_map_size)
++ {
++ xheader_store (xattr_map[scan_xattr].xkey, st, &scan_xattr);
++ ++scan_xattr;
++ }
++ }
++ }
++
+ return header;
+ }
+
+@@ -1711,6 +1736,10 @@
+ bool ok;
+ struct stat final_stat;
+
++ xattrs_acls_get(st, p, fd, !is_dir);
++ xattrs_selinux_get(st, p, fd);
++ xattrs_xattrs_get(st, p, fd);
++
+ if (is_dir)
+ {
+ const char *tag_file_name;
+@@ -1829,6 +1858,9 @@
+ if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size)
+ write_long_link (st);
+
++ xattrs_selinux_get(st, p, -1);
++ xattrs_xattrs_get(st, p, -1);
++
+ block_ordinal = current_block_ordinal ();
+ st->stat.st_size = 0; /* force 0 size on symlink */
+ header = start_header (st);
+@@ -1847,11 +1879,23 @@
+ }
+ #endif
+ else if (S_ISCHR (st->stat.st_mode))
+- type = CHRTYPE;
++ {
++ type = CHRTYPE;
++ xattrs_selinux_get(st, p, -1);
++ xattrs_xattrs_get(st, p, -1);
++ }
+ else if (S_ISBLK (st->stat.st_mode))
+- type = BLKTYPE;
++ {
++ type = BLKTYPE;
++ xattrs_selinux_get(st, p, -1);
++ xattrs_xattrs_get(st, p, -1);
++ }
+ else if (S_ISFIFO (st->stat.st_mode))
+- type = FIFOTYPE;
++ {
++ type = FIFOTYPE;
++ xattrs_selinux_get(st, p, -1);
++ xattrs_xattrs_get(st, p, -1);
++ }
+ else if (S_ISSOCK (st->stat.st_mode))
+ {
+ WARNOPT (WARN_FILE_IGNORED,
+diff -Naur tar-1.26.orig//src/extract.c tar-1.26/src/extract.c
+--- tar-1.26.orig//src/extract.c 2010-11-27 05:33:22.000000000 -0500
++++ tar-1.26/src/extract.c 2011-09-07 06:13:38.000000000 -0400
+@@ -97,6 +97,14 @@
+ /* Directory that the name is relative to. */
+ int change_dir;
+
++ /* extended attributes*/
++ char *cntx_name;
++ char *acls_a_ptr;
++ size_t acls_a_len;
++ char *acls_d_ptr;
++ size_t acls_d_len;
++ size_t xattr_map_size; /* Size of the xattr map */
++ struct xattr_array *xattr_map;
+ /* Length and contents of name. */
+ size_t file_name_len;
+ char file_name[1];
+@@ -134,6 +142,18 @@
+ hard-linked together. */
+ struct string_list *sources;
+
++ /* SELinux context */
++ char *cntx_name;
++
++ /* ACLs */
++ char *acls_a_ptr;
++ size_t acls_a_len;
++ char *acls_d_ptr;
++ size_t acls_d_len;
++
++ size_t xattr_map_size; /* Size of the xattr map */
++ struct xattr_array *xattr_map;
++
+ /* The desired target of the desired link. */
+ char target[1];
+ };
+@@ -335,6 +355,10 @@
+ utime_error (file_name);
+ }
+
++ xattrs_acls_set(st, file_name, typeflag);
++ xattrs_selinux_set(st, file_name, typeflag);
++ xattrs_xattrs_set(st, file_name, typeflag);
++
+ if (0 < same_owner_option && ! interdir)
+ {
+ /* Some systems allow non-root users to give files away. Once this
+@@ -431,6 +455,36 @@
+ data->atflag = atflag;
+ data->after_links = 0;
+ data->change_dir = chdir_current;
++ data->cntx_name = NULL;
++ if (st)
++ assign_string (&data->cntx_name, st->cntx_name);
++ if (st && st->acls_a_ptr)
++ {
++ data->acls_a_ptr = xmemdup(st->acls_a_ptr, st->acls_a_len + 1);
++ data->acls_a_len = st->acls_a_len;
++ }
++ else
++ {
++ data->acls_a_ptr = NULL;
++ data->acls_a_len = 0;
++ }
++ if (st && st->acls_d_ptr)
++ {
++ data->acls_d_ptr = xmemdup(st->acls_d_ptr, st->acls_d_len + 1);
++ data->acls_d_len = st->acls_d_len;
++ }
++ else
++ {
++ data->acls_d_ptr = NULL;
++ data->acls_d_len = 0;
++ }
++ if (st)
++ xheader_xattr_copy (st, &data->xattr_map, &data->xattr_map_size);
++ else
++ {
++ data->xattr_map = NULL;
++ data->xattr_map_size = 0;
++ }
+ strcpy (data->file_name, file_name);
+ delayed_set_stat_head = data;
+ if (must_be_dot_or_slash (file_name))
+@@ -673,6 +727,31 @@
+ return RECOVER_NO;
+ }
+
++/* Restore stat extended attributes (xattr) for FILE_NAME, using information
++ given in *ST. Restore before extraction because they may affect layout.
++ 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 */
++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;
++ bool interdir_made = false;
++
++ if ((xattrs_option >= 0) && st->xattr_map_size) {
++ mode_t mode = current_stat_info.stat.st_mode & MODE_RWX & ~ current_umask;
++
++ do
++ status = mknod (file_name, mode ^ invert_permissions, 0);
++ while (status && maybe_recoverable ((char *)file_name, false, &interdir_made));
++ xattrs_xattrs_set(st, file_name, typeflag);
++ *file_created = 1;
++ }
++ return(status);
++}
++
+ /* Fix the statuses of all directories whose statuses need fixing, and
+ which are not ancestors of FILE_NAME. If AFTER_LINKS is
+ nonzero, do this for all such directories; otherwise, stop at the
+@@ -733,12 +812,23 @@
+ sb.stat.st_gid = data->gid;
+ sb.atime = data->atime;
+ sb.mtime = data->mtime;
++ sb.cntx_name = data->cntx_name;
++ sb.acls_a_ptr = data->acls_a_ptr;
++ sb.acls_a_len = data->acls_a_len;
++ sb.acls_d_ptr = data->acls_d_ptr;
++ sb.acls_d_len = data->acls_d_len;
++ sb.xattr_map = data->xattr_map;
++ sb.xattr_map_size = data->xattr_map_size;
+ set_stat (data->file_name, &sb,
+ -1, current_mode, current_mode_mask,
+ DIRTYPE, data->interdir, data->atflag);
+ }
+
+ delayed_set_stat_head = data->next;
++ xheader_xattr_free (data->xattr_map, data->xattr_map_size);
++ free (data->cntx_name);
++ free (data->acls_a_ptr);
++ free (data->acls_d_ptr);
+ free (data);
+ }
+ }
+@@ -854,6 +944,7 @@
+
+ static int
+ open_output_file (char const *file_name, int typeflag, mode_t mode,
++ int file_created,
+ mode_t *current_mode, mode_t *current_mode_mask)
+ {
+ int fd;
+@@ -864,6 +955,10 @@
+ ? O_TRUNC | (dereference_option ? 0 : O_NOFOLLOW)
+ : O_EXCL));
+
++ /* File might be created in set_xattr. So clear O_EXCL to avoid open() failure */
++ if (file_created)
++ openflag = openflag & ~O_EXCL;
++
+ if (typeflag == CONTTYPE)
+ {
+ static int conttype_diagnosed;
+@@ -934,6 +1029,7 @@
+ bool interdir_made = false;
+ mode_t mode = (current_stat_info.stat.st_mode & MODE_RWX
+ & ~ (0 < same_owner_option ? S_IRWXG | S_IRWXO : 0));
++ mode_t invert_permissions = 0 < same_owner_option ? mode & (S_IRWXG | S_IRWXO) : 0;
+ mode_t current_mode = 0;
+ mode_t current_mode_mask = 0;
+
+@@ -950,7 +1046,17 @@
+ }
+ else
+ {
++ int file_created = 0;
++ if (set_xattr (file_name, ¤t_stat_info, invert_permissions,
++ typeflag, &file_created))
++ {
++ skip_member ();
++ open_error (file_name);
++ return 1;
++ }
++
+ while ((fd = open_output_file (file_name, typeflag, mode,
++ file_created,
+ ¤t_mode, ¤t_mode_mask))
+ < 0)
+ {
+@@ -1091,6 +1197,13 @@
+ + strlen (file_name) + 1);
+ p->sources->next = 0;
+ strcpy (p->sources->string, file_name);
++ p->cntx_name = NULL;
++ assign_string (&p->cntx_name, current_stat_info.cntx_name);
++ p->acls_a_ptr = NULL;
++ p->acls_a_len = 0;
++ p->acls_d_ptr = NULL;
++ p->acls_d_len = 0;
++ xheader_xattr_copy (¤t_stat_info, &p->xattr_map, &p->xattr_map_size);
+ strcpy (p->target, current_stat_info.link_name);
+
+ h = delayed_set_stat_head;
+@@ -1525,6 +1638,13 @@
+ st1.stat.st_gid = ds->gid;
+ st1.atime = ds->atime;
+ st1.mtime = ds->mtime;
++ st1.cntx_name = ds->cntx_name;
++ st1.acls_a_ptr = ds->acls_a_ptr;
++ st1.acls_a_len = ds->acls_a_len;
++ st1.acls_d_ptr = ds->acls_d_ptr;
++ st1.acls_d_len = ds->acls_d_len;
++ st1.xattr_map = ds->xattr_map;
++ st1.xattr_map_size = ds->xattr_map_size;
+ set_stat (source, &st1, -1, 0, 0, SYMTYPE,
+ false, AT_SYMLINK_NOFOLLOW);
+ valid_source = source;
+@@ -1539,6 +1659,9 @@
+ sources = next;
+ }
+
++ xheader_xattr_free (ds->xattr_map, ds->xattr_map_size);
++ free (ds->cntx_name);
++
+ {
+ struct delayed_link *next = ds->next;
+ free (ds);
+diff -Naur tar-1.26.orig//src/list.c tar-1.26/src/list.c
+--- tar-1.26.orig//src/list.c 2011-02-16 17:12:16.000000000 -0500
++++ tar-1.26/src/list.c 2011-09-07 06:13:38.000000000 -0400
+@@ -604,6 +604,13 @@
+ assign_string (&stat_info->gname,
+ header->header.gname[0] ? header->header.gname : NULL);
+
++ stat_info->acls_a_ptr = NULL;
++ stat_info->acls_a_len = 0;
++ stat_info->acls_d_ptr = NULL;
++ stat_info->acls_d_len = 0;
++ stat_info->cntx_name = NULL;
++ xheader_xattr_init(stat_info);
++
+ if (format == OLDGNU_FORMAT && incremental_option)
+ {
+ stat_info->atime.tv_sec = TIME_FROM_HEADER (header->oldgnu_header.atime);
+diff -Naur tar-1.26.orig//src/Makefile.am tar-1.26/src/Makefile.am
+--- tar-1.26.orig//src/Makefile.am 2010-10-24 14:07:54.000000000 -0400
++++ tar-1.26/src/Makefile.am 2011-09-07 06:13:38.000000000 -0400
+@@ -20,7 +20,7 @@
+
+ bin_PROGRAMS = tar
+
+-noinst_HEADERS = arith.h common.h tar.h
++noinst_HEADERS = arith.h common.h tar.h xattrs.h
+ tar_SOURCES = \
+ buffer.c\
+ checkpoint.c\
+@@ -42,10 +42,11 @@
+ unlink.c\
+ update.c\
+ utf8.c\
+- warning.c
++ warning.c\
++ xattrs.c
+
+ INCLUDES = -I$(top_srcdir)/gnu -I../ -I../gnu -I$(top_srcdir)/lib -I../lib
+
+ LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV)
+
+-tar_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)
++tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)
+diff -Naur tar-1.26.orig//src/tar.c tar-1.26/src/tar.c
+--- tar-1.26.orig//src/tar.c 2010-10-24 14:07:55.000000000 -0400
++++ tar-1.26/src/tar.c 2011-09-07 06:13:38.000000000 -0400
+@@ -255,7 +255,8 @@
+
+ enum
+ {
+- ANCHORED_OPTION = CHAR_MAX + 1,
++ ACLS_OPTION = CHAR_MAX + 1,
++ ANCHORED_OPTION,
+ ATIME_PRESERVE_OPTION,
+ BACKUP_OPTION,
+ CHECK_DEVICE_OPTION,
+@@ -288,6 +289,7 @@
+ MODE_OPTION,
+ MTIME_OPTION,
+ NEWER_MTIME_OPTION,
++ NO_ACLS_OPTION,
+ NO_ANCHORED_OPTION,
+ NO_AUTO_COMPRESS_OPTION,
+ NO_CHECK_DEVICE_OPTION,
+@@ -301,9 +303,11 @@
+ NO_SAME_OWNER_OPTION,
+ NO_SAME_PERMISSIONS_OPTION,
+ NO_SEEK_OPTION,
++ NO_SELINUX_CONTEXT_OPTION,
+ NO_UNQUOTE_OPTION,
+ NO_WILDCARDS_MATCH_SLASH_OPTION,
+ NO_WILDCARDS_OPTION,
++ NO_XATTR_OPTION,
+ NULL_OPTION,
+ NUMERIC_OWNER_OPTION,
+ OCCURRENCE_OPTION,
+@@ -325,6 +329,7 @@
+ RMT_COMMAND_OPTION,
+ RSH_COMMAND_OPTION,
+ SAME_OWNER_OPTION,
++ SELINUX_CONTEXT_OPTION,
+ SHOW_DEFAULTS_OPTION,
+ SHOW_OMITTED_DIRS_OPTION,
+ SHOW_TRANSFORMED_NAMES_OPTION,
+@@ -340,7 +345,8 @@
+ VOLNO_FILE_OPTION,
+ WARNING_OPTION,
+ WILDCARDS_MATCH_SLASH_OPTION,
+- WILDCARDS_OPTION
++ WILDCARDS_OPTION,
++ XATTR_OPTION
+ };
+
+ const char *argp_program_version = "tar (" PACKAGE_NAME ") " VERSION;
+@@ -486,6 +492,10 @@
+ {NULL, 0, NULL, 0,
+ N_("Handling of file attributes:"), GRID },
+
++ {"acls", ACLS_OPTION, 0, 0,
++ N_("Save the ACLs to the archive"), GRID+1 },
++ {"no-acls", NO_ACLS_OPTION, 0, 0,
++ N_("Don't extract the ACLs from the archive"), GRID+1 },
+ {"owner", OWNER_OPTION, N_("NAME"), 0,
+ N_("force NAME as owner for added files"), GRID+1 },
+ {"group", GROUP_OPTION, N_("NAME"), 0,
+@@ -516,6 +526,14 @@
+ {"preserve-order", 's', 0, 0,
+ N_("sort names to extract to match archive"), GRID+1 },
+ {"same-order", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
++ {"selinux", SELINUX_CONTEXT_OPTION, 0, 0,
++ N_("Save the SELinux context to the archive"), GRID+1 },
++ {"no-selinux", NO_SELINUX_CONTEXT_OPTION, 0, 0,
++ N_("Don't extract the SELinux context from the archive"), GRID+1 },
++ {"xattrs", XATTR_OPTION, 0, 0,
++ N_("Save the user/root xattrs to the archive"), GRID+1 },
++ {"no-xattrs", NO_XATTR_OPTION, 0, 0,
++ N_("Don't extract the user/root xattrs from the archive"), GRID+1 },
+ {"preserve", PRESERVE_OPTION, 0, 0,
+ N_("same as both -p and -s"), GRID+1 },
+ {"delay-directory-restore", DELAY_DIRECTORY_RESTORE_OPTION, 0, 0,
+@@ -2079,6 +2097,37 @@
+ same_permissions_option = -1;
+ break;
+
++ case ACLS_OPTION:
++ set_archive_format ("posix");
++ acls_option = 1;
++ break;
++
++ case NO_ACLS_OPTION:
++ acls_option = -1;
++ break;
++
++ case SELINUX_CONTEXT_OPTION:
++ set_archive_format ("posix");
++ selinux_context_option = 1;
++ break;
++
++ case NO_SELINUX_CONTEXT_OPTION:
++ selinux_context_option = -1;
++ break;
++
++ case XATTR_OPTION:
++ set_archive_format ("posix");
++ if (!acls_option) acls_option = 1;
++ if (!selinux_context_option) selinux_context_option = 1;
++ xattrs_option = 1;
++ break;
++
++ case NO_XATTR_OPTION:
++ if (!acls_option) acls_option = -1;
++ if (!selinux_context_option) selinux_context_option = -1;
++ xattrs_option = -1;
++ break;
++
+ case RECURSION_OPTION:
+ recursion_option = FNM_LEADING_DIR;
+ break;
+@@ -2461,6 +2510,29 @@
+ || subcommand_option != LIST_SUBCOMMAND))
+ USAGE_ERROR ((0, 0, _("--pax-option can be used only on POSIX archives")));
+
++ /* star create's non-POSIX typed archives with xattr support, so allow the
++ extra headers */
++ if ((acls_option > 0)
++ && archive_format != POSIX_FORMAT
++ && (subcommand_option != EXTRACT_SUBCOMMAND
++ || subcommand_option != DIFF_SUBCOMMAND
++ || subcommand_option != LIST_SUBCOMMAND))
++ USAGE_ERROR ((0, 0, _("--acls can be used only on POSIX archives")));
++
++ if ((selinux_context_option > 0)
++ && archive_format != POSIX_FORMAT
++ && (subcommand_option != EXTRACT_SUBCOMMAND
++ || subcommand_option != DIFF_SUBCOMMAND
++ || subcommand_option != LIST_SUBCOMMAND))
++ USAGE_ERROR ((0, 0, _("--selinux can be used only on POSIX archives")));
++
++ if ((xattrs_option > 0)
++ && archive_format != POSIX_FORMAT
++ && (subcommand_option != EXTRACT_SUBCOMMAND
++ || subcommand_option != DIFF_SUBCOMMAND
++ || subcommand_option != LIST_SUBCOMMAND))
++ USAGE_ERROR ((0, 0, _("--xattrs can be used only on POSIX archives")));
++
+ /* If ready to unlink hierarchies, so we are for simpler files. */
+ if (recursive_unlink_option)
+ old_files_option = UNLINK_FIRST_OLD_FILES;
+@@ -2713,11 +2785,15 @@
+ tar_stat_destroy (struct tar_stat_info *st)
+ {
+ tar_stat_close (st);
++ xheader_xattr_free (st->xattr_map, st->xattr_map_size);
+ free (st->orig_file_name);
+ free (st->file_name);
+ free (st->link_name);
+ free (st->uname);
+ free (st->gname);
++ free (st->cntx_name);
++ free (st->acls_a_ptr);
++ free (st->acls_d_ptr);
+ free (st->sparse_map);
+ free (st->dumpdir);
+ xheader_destroy (&st->xhdr);
+diff -Naur tar-1.26.orig//src/tar.h tar-1.26/src/tar.h
+--- tar-1.26.orig//src/tar.h 2010-10-24 14:07:46.000000000 -0400
++++ tar-1.26/src/tar.h 2011-09-07 06:13:38.000000000 -0400
+@@ -276,6 +276,14 @@
+ uintmax_t string_length;
+ };
+
++/* Information about xattrs for a file. */
++struct xattr_array
++ {
++ char *xkey;
++ char *xval_ptr;
++ size_t xval_len;
++ };
++
+ struct tar_stat_info
+ {
+ char *orig_file_name; /* name of file read from the archive header */
+@@ -287,6 +295,15 @@
+
+ char *uname; /* user name of owner */
+ char *gname; /* group name of owner */
++
++ char *cntx_name; /* SELinux context for the current archive entry. */
++
++ char *acls_a_ptr; /* Access ACLs for the current archive entry. */
++ size_t acls_a_len; /* Access ACLs for the current archive entry. */
++
++ char *acls_d_ptr; /* Default ACLs for the current archive entry. */
++ size_t acls_d_len; /* Default ACLs for the current archive entry. */
++
+ struct stat stat; /* regular filesystem stat */
+
+ /* STAT doesn't always have access, data modification, and status
+@@ -309,6 +326,9 @@
+ size_t sparse_map_size; /* Size of the sparse map */
+ struct sp_array *sparse_map;
+
++ size_t xattr_map_size; /* Size of the xattr map */
++ struct xattr_array *xattr_map;
++
+ /* Extended headers */
+ struct xheader xhdr;
+
+diff -Naur tar-1.26.orig//src/xattrs.c tar-1.26/src/xattrs.c
+--- tar-1.26.orig//src/xattrs.c 1969-12-31 19:00:00.000000000 -0500
++++ tar-1.26/src/xattrs.c 2011-09-07 06:13:38.000000000 -0400
+@@ -0,0 +1,489 @@
++/* Create a tar archive.
++
++ Copyright (C) 2006 Free Software Foundation, Inc.
++
++ Written by James Antill, on 2006-07-27.
++
++ 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 2, 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. */
++
++#include <system.h>
++
++#include <quotearg.h>
++
++#include "common.h"
++
++
++#ifndef HAVE_SELINUX_SELINUX_H
++# undef HAVE_LIBSELINUX
++#endif
++
++#ifndef HAVE_ATTR_XATTR_H
++# undef HAVE_XATTRS
++#endif
++
++#ifndef HAVE_SYS_ACL_H
++# undef HAVE_LIBACL
++#endif
++
++#ifdef HAVE_SELINUX_SELINUX_H
++# include <selinux/selinux.h>
++#endif
++
++#ifdef HAVE_ATTR_XATTR_H
++# include <attr/xattr.h>
++#endif
++
++#ifdef HAVE_SYS_ACL_H
++# include <sys/acl.h>
++#endif
++
++
++#if 0 /* unused by xattr's atm. */
++static void xattrs__fd_get(struct tar_stat_info *st,
++ char const *file_name, int fd, const char *attr,
++ char **ret_ptr, size_t *ret_len)
++{
++#ifdef HAVE_XATTRS
++ static ssize_t asz = 1024;
++ ssize_t ret = 0;
++ static char *val = NULL;
++
++ if (!val) val = xmalloc (asz);
++
++ while (((ret = fgetxattr (fd, attr, val, asz)) == -1) &&
++ (errno == ERANGE))
++ {
++ asz <<= 1;
++ val = xrealloc (val, asz);
++ }
++
++ if (ret != -1)
++ {
++ *ret_ptr = xmemdup (val, ret + 1);
++ *ret_len = ret;
++ }
++ else if (errno != ENOATTR)
++ call_arg_warn ("fgetxattr", file_name);
++#endif
++}
++#endif
++
++static void xattrs__acls_get_a(struct tar_stat_info *st,
++ char const *file_name, int fd,
++ char **ret_ptr, size_t *ret_len)
++{ /* "system.posix_acl_access" */
++#ifdef HAVE_LIBACL
++ char *val = NULL;
++ ssize_t len;
++ acl_t acl;
++
++ if (fd != -1)
++ {
++ if ((acl = acl_get_fd (fd)) == (acl_t)NULL)
++ {
++ if (errno != ENOTSUP)
++ call_arg_warn ("acl_get_fd", file_name);
++ return;
++ }
++ }
++ else if ((acl = acl_get_file (file_name, ACL_TYPE_ACCESS)) == (acl_t)NULL)
++ {
++ if (errno != ENOTSUP)
++ call_arg_warn ("acl_get_file", file_name);
++ return;
++ }
++
++
++ val = acl_to_text(acl, &len);
++ acl_free (acl);
++
++ if (val == NULL)
++ {
++ call_arg_warn ("acl_to_text", file_name);
++ return;
++ }
++
++ *ret_ptr = xstrdup (val);
++ *ret_len = len;
++
++ acl_free (val);
++#endif
++}
++
++static void xattrs__acls_get_d(struct tar_stat_info *st,
++ char const *file_name,
++ char **ret_ptr, size_t *ret_len)
++{ /* "system.posix_acl_default" */
++#ifdef HAVE_LIBACL
++ char *val = NULL;
++ ssize_t len;
++ acl_t acl;
++
++ if ((acl = acl_get_file (file_name, ACL_TYPE_DEFAULT)) == (acl_t)NULL)
++ {
++ if (errno != ENOTSUP)
++ call_arg_warn ("acl_get_file", file_name);
++ return;
++ }
++
++ val = acl_to_text(acl, &len);
++ acl_free (acl);
++
++ if (val == NULL)
++ {
++ call_arg_warn ("acl_to_text", file_name);
++ return;
++ }
++
++ *ret_ptr = xstrdup (val);
++ *ret_len = len;
++
++ acl_free (val);
++#endif
++}
++
++void xattrs_acls_get(struct tar_stat_info *st, char const *file_name, int fd,
++ int xisfile)
++{
++ if (acls_option > 0)
++ {
++#ifndef HAVE_LIBACL
++ static int done = 0;
++ if (!done)
++ WARN ((0, 0, _("ACL support requested, but not available")));
++ done = 1;
++#endif
++ xattrs__acls_get_a (st, file_name, fd,
++ &st->acls_a_ptr, &st->acls_a_len);
++ if (!xisfile)
++ xattrs__acls_get_d (st, file_name,
++ &st->acls_d_ptr, &st->acls_d_len);
++ }
++}
++
++void xattrs_selinux_get(struct tar_stat_info *st, char const *file_name, int fd)
++{
++ if (selinux_context_option > 0)
++ {
++#ifndef HAVE_LIBSELINUX
++ static int done = 0;
++ if (!done)
++ WARN ((0, 0, _("SELinux support requested, but not available")));
++ done = 1;
++#else
++ if (fd == -1)
++ {
++ if ((lgetfilecon (file_name, &st->cntx_name) == -1) && (errno != ENOTSUP) && (errno != ENODATA))
++ call_arg_warn ("lgetfilecon", file_name);
++ }
++ else if ((fgetfilecon (fd, &st->cntx_name) == -1) && (errno != ENOTSUP) && (errno != ENODATA))
++ call_arg_warn ("fgetfilecon", file_name);
++#endif
++ }
++}
++
++void xattrs_xattrs_get(struct tar_stat_info *st, char const *file_name, int fd)
++{
++ if (xattrs_option > 0)
++ { /* get all xattrs ... this include security.* and system.* if
++ available. We filter them here, but we have to filter them
++ in xattrs_xattrs_set() anyway.
++ */
++ static ssize_t xsz = 1024;
++ static char *xatrs = NULL;
++ ssize_t xret = -1;
++
++#ifndef HAVE_XATTRS
++ static int done = 0;
++ if ((xattrs_option > 0) && !done)
++ WARN ((0, 0, _("Xattr support requested, but not available")));
++ done = 1;
++#else
++
++ if (!xatrs) xatrs = xmalloc (xsz);
++
++ while (((fd == -1) ?
++ ((xret = llistxattr (file_name, xatrs, xsz)) == -1) :
++ ((xret = flistxattr (fd, xatrs, xsz)) == -1)) &&
++ (errno == ERANGE))
++ {
++ xsz <<= 1;
++ xatrs = xrealloc (xatrs, xsz);
++ }
++
++ if (xret == -1)
++ call_arg_warn ((fd == -1) ? "llistxattrs" : "flistxattrs", file_name);
++ else
++ {
++ const char *attr = xatrs;
++ static ssize_t asz = 1024;
++ static char *val = NULL;
++
++ if (!val) val = xmalloc (asz);
++
++ while (xret > 0)
++ {
++ 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 == -1) ?
++ ((aret = lgetxattr (file_name, attr, val, asz)) == -1) :
++ ((aret = fgetxattr (fd, attr, val, asz)) == -1)) &&
++ (errno == ERANGE))
++ {
++ asz <<= 1;
++ val = xrealloc (val, asz);
++ }
++
++ if (aret != -1)
++ xheader_xattr_add (st, attr, val, aret);
++ else if (errno != ENOATTR)
++ call_arg_warn ((fd==-1) ? "lgetxattr" : "fgetxattr", file_name);
++
++ attr += len + 1;
++ xret -= len + 1;
++ }
++ }
++#endif
++ }
++}
++
++static void xattrs__fd_set(struct tar_stat_info const *st,
++ char const *file_name, char typeflag,
++ const char *attr,
++ const char *ptr, size_t len)
++{
++#ifdef HAVE_XATTRS
++ if (ptr)
++ {
++ const char *sysname = "setxattr";
++ int ret = -1;
++
++ if (typeflag != SYMTYPE)
++ ret = setxattr (file_name, attr, ptr, len, 0);
++ else
++ {
++ sysname = "lsetxattr";
++ ret = lsetxattr (file_name, attr, ptr, len, 0);
++ }
++
++ /* do not print warnings when SELinux is disabled */
++ if ((ret == -1) && (errno != EPERM) && (errno != ENOTSUP))
++ call_arg_error(sysname, file_name);
++ }
++#endif
++}
++
++/* convert unix permissions into an ACL ... needed due to "default" ACLs */
++#ifdef HAVE_LIBACL
++static acl_t perms2acl(int perms)
++{
++ char val[] = "user::---,group::---,other::---";
++ /* 0123456789 123456789 123456789 123456789 */
++
++ /* user */
++ if (perms & 0400) val[ 6] = 'r';
++ if (perms & 0200) val[ 7] = 'w';
++ if (perms & 0100) val[ 8] = 'x';
++
++ /* group */
++ if (perms & 0040) val[17] = 'r';
++ if (perms & 0020) val[18] = 'w';
++ if (perms & 0010) val[19] = 'x';
++
++ /* other */
++ if (perms & 0004) val[28] = 'r';
++ if (perms & 0002) val[29] = 'w';
++ if (perms & 0001) val[30] = 'x';
++
++ return (acl_from_text (val));
++}
++#endif
++
++static char *skip_to_ext_fields(char *ptr)
++{
++ ptr += strcspn(ptr, ":,\n"); /* skip tag name. Ie. user/group/default/mask */
++
++ if (*ptr != ':')
++ return (ptr); /* error? no user/group field */
++ ++ptr;
++
++ ptr += strcspn(ptr, ":,\n"); /* skip user/group name */
++
++ if (*ptr != ':')
++ return (ptr); /* error? no perms field */
++ ++ptr;
++
++ ptr += strcspn(ptr, ":,\n"); /* skip perms */
++
++ if (*ptr != ':')
++ return (ptr); /* no extra fields */
++
++ return (ptr);
++}
++
++/* The POSIX draft allows extra fields after the three main ones. Star
++ uses this to add a fourth field for user/group which is the numeric ID.
++ We just skip all extra fields atm. */
++static const char *fixup_extra_acl_fields(const char *ptr)
++{
++ char *src = (char *)ptr;
++ char *dst = (char *)ptr;
++
++ while (*src)
++ {
++ const char *old = src;
++ size_t len = 0;
++
++ src = skip_to_ext_fields(src);
++ len = src - old;
++ if (old != dst) memmove(dst, old, len);
++ dst += len;
++
++ if (*src == ':') /* We have extra fields, skip them all */
++ src += strcspn(src, "\n,");
++
++ if ((*src == '\n') || (*src == ','))
++ *dst++ = *src++; /* also done when dst == src, but that's ok */
++ }
++ if (src != dst)
++ *dst = 0;
++
++ return ptr;
++}
++
++static void xattrs__acls_set(struct tar_stat_info const *st,
++ char const *file_name, int type,
++ const char *ptr, size_t len)
++{ /* "system.posix_acl_access" */
++#ifdef HAVE_LIBACL
++ acl_t acl;
++
++ if (ptr)
++ {
++ /* assert (strlen (ptr) == len); */
++ ptr = fixup_extra_acl_fields(ptr);
++
++ acl = acl_from_text (ptr);
++ acls_option = 1;
++ }
++ else if (acls_option > 0)
++ acl = perms2acl (st->stat.st_mode);
++ else
++ return; /* don't call acl functions unless we first hit an ACL, or
++ --acls was passed explicitly */
++
++ if (acl == (acl_t)NULL)
++ {
++ call_arg_warn ("acl_from_text", file_name);
++ return;
++ }
++
++ if (acl_set_file (file_name, type, acl) == -1)
++ {
++ if (errno != ENOTSUP)
++ call_arg_warn ("acl_set_file", file_name);
++ }
++ acl_free (acl);
++#endif
++}
++
++void xattrs_acls_set(struct tar_stat_info const *st,
++ char const *file_name, char typeflag)
++{
++ if ((acls_option >= 0) && (typeflag != SYMTYPE))
++ {
++#ifndef HAVE_LIBACL
++ static int done = 0;
++ if (!done)
++ WARN ((0, 0, _("ACL support requested, but not available")));
++ done = 1;
++#else
++ xattrs__acls_set (st, file_name, ACL_TYPE_ACCESS,
++ st->acls_a_ptr, st->acls_a_len);
++ if ((typeflag == DIRTYPE) || (typeflag == GNUTYPE_DUMPDIR))
++ xattrs__acls_set (st, file_name, ACL_TYPE_DEFAULT,
++ st->acls_d_ptr, st->acls_d_len);
++#endif
++ }
++}
++
++void xattrs_selinux_set(struct tar_stat_info const *st,
++ char const *file_name, char typeflag)
++{
++ if ((selinux_context_option >= 0) && st->cntx_name)
++ {
++ const char *sysname = "setfilecon";
++ int ret = -1;
++
++#ifndef HAVE_LIBSELINUX
++ static int done = 0;
++ if (!done)
++ WARN ((0, 0, _("SELinux support requested, but not available")));
++ done = 1;
++#else
++ if (typeflag != SYMTYPE)
++ ret = setfilecon (file_name, st->cntx_name);
++ else
++ {
++ sysname = "lsetfilecon";
++ ret = lsetfilecon (file_name, st->cntx_name);
++ }
++
++ if ((ret == -1) && (errno == EPERM))
++ call_arg_warn(sysname, file_name);
++ else if ((ret == -1) && (errno != EOPNOTSUPP))
++ call_arg_error(sysname, file_name);
++#endif
++ }
++}
++
++void xattrs_xattrs_set(struct tar_stat_info const *st,
++ char const *file_name, char typeflag)
++{
++ if ((xattrs_option >= 0) && st->xattr_map_size)
++ {
++ size_t scan = 0;
++
++#ifndef HAVE_XATTRS
++ static int done = 0;
++ if (!done)
++ WARN ((0, 0, _("Xattr support requested, but not available")));
++ done = 1;
++#else
++ while (scan < st->xattr_map_size)
++ {
++ char *keyword = st->xattr_map[scan].xkey;
++
++ /* assert (!memcpy (keyword, "SCHILY.xattr.", strlen("SCHILY.xattr."))); */
++ keyword += strlen("SCHILY.xattr.");
++
++ if (strncmp (keyword, "user.", strlen("user.")) &&
++ strncmp (keyword, "lustre.", strlen("lustre.")) &&
++ strncmp (keyword, "trusted.", strlen("trusted.")) &&
++ strncmp (keyword, "security.NTACL", strlen("security.NTACL")))
++ continue; /* don't try and set anything but normal xattrs */
++
++ xattrs__fd_set (st, file_name, typeflag, keyword,
++ st->xattr_map[scan].xval_ptr,
++ st->xattr_map[scan].xval_len);
++
++ ++scan;
++ }
++#endif
++ }
++}
+diff -Naur tar-1.26.orig//src/xattrs.h tar-1.26/src/xattrs.h
+--- tar-1.26.orig//src/xattrs.h 1969-12-31 19:00:00.000000000 -0500
++++ tar-1.26/src/xattrs.h 2011-09-07 06:13:38.000000000 -0400
+@@ -0,0 +1,14 @@
++
++extern void xattrs_acls_get(struct tar_stat_info *st,
++ char const *file_name, int fd, int xisfile);
++extern void xattrs_selinux_get(struct tar_stat_info *st,
++ char const *file_name, int fd);
++extern void xattrs_xattrs_get(struct tar_stat_info *st,
++ char const *file_name, int fd);
++
++extern void xattrs_acls_set(struct tar_stat_info const *st,
++ char const *file_name, char typeflag);
++extern void xattrs_selinux_set(struct tar_stat_info const *st,
++ char const *file_name, char typeflag);
++extern void xattrs_xattrs_set(struct tar_stat_info const *st,
++ char const *file_name, char typeflag);
+diff -Naur tar-1.26.orig//src/xheader.c tar-1.26/src/xheader.c
+--- tar-1.26.orig//src/xheader.c 2010-11-27 06:18:49.000000000 -0500
++++ tar-1.26/src/xheader.c 2011-09-07 06:13:38.000000000 -0400
+@@ -460,6 +460,74 @@
+ }
+ }
+
++void xheader_xattr_init(struct tar_stat_info *st)
++{
++ st->xattr_map = NULL;
++ st->xattr_map_size = 0;
++}
++
++void xheader_xattr_free(struct xattr_array *xattr_map, size_t xattr_map_size)
++{
++ size_t scan = 0;
++
++ while (scan < xattr_map_size)
++ {
++ free (xattr_map[scan].xkey);
++ free (xattr_map[scan].xval_ptr);
++
++ ++scan;
++ }
++ free (xattr_map);
++}
++
++static void xheader_xattr__add(struct xattr_array **xattr_map,
++ size_t *xattr_map_size,
++ const char *key, const char *val, size_t len)
++{
++ size_t pos = (*xattr_map_size)++;
++
++ *xattr_map = xrealloc (*xattr_map,
++ *xattr_map_size * sizeof(struct xattr_array));
++ (*xattr_map)[pos].xkey = xstrdup (key);
++ (*xattr_map)[pos].xval_ptr = xmemdup (val, len + 1);
++ (*xattr_map)[pos].xval_len = len;
++}
++
++void xheader_xattr_add(struct tar_stat_info *st,
++ const char *key, const char *val, size_t len)
++{
++ size_t klen = strlen (key);
++ char *xkey = xmalloc (strlen("SCHILY.xattr.") + klen + 1);
++ char *tmp = xkey;
++
++ tmp = stpcpy (tmp, "SCHILY.xattr.");
++ tmp = stpcpy (tmp, key);
++
++ xheader_xattr__add (&st->xattr_map, &st->xattr_map_size, xkey, val, len);
++
++ free (xkey);
++}
++
++void xheader_xattr_copy(const struct tar_stat_info *st,
++ struct xattr_array **xattr_map, size_t *xattr_map_size)
++{
++ size_t scan = 0;
++
++ *xattr_map = NULL;
++ *xattr_map_size = 0;
++
++ while (scan < st->xattr_map_size)
++ {
++ char *key = st->xattr_map[scan].xkey;
++ char *val = st->xattr_map[scan].xval_ptr;
++ size_t len = st->xattr_map[scan].xval_len;
++
++ xheader_xattr__add(xattr_map, xattr_map_size, key, val, len);
++
++ ++scan;
++ }
++}
++
+ \f
+ /* General Interface */
+
+@@ -473,6 +541,7 @@
+ struct xheader *, void const *data);
+ void (*decoder) (struct tar_stat_info *, char const *, char const *, size_t);
+ int flags;
++ bool prefix;
+ };
+
+ /* This declaration must be extern, because ISO C99 section 6.9.2
+@@ -489,8 +558,17 @@
+ struct xhdr_tab const *p;
+
+ for (p = xhdr_tab; p->keyword; p++)
+- if (strcmp (p->keyword, keyword) == 0)
+- return p;
++ if (p->prefix)
++ {
++ if (strncmp (p->keyword, keyword, strlen(p->keyword)) == 0)
++ return p;
++ }
++ else
++ {
++ if (strcmp (p->keyword, keyword) == 0)
++ return p;
++ }
++
+ return NULL;
+ }
+
+@@ -500,7 +578,7 @@
+ struct xhdr_tab const *p;
+
+ for (p = xhdr_tab; p->keyword; p++)
+- if ((p->flags & XHDR_PROTECTED) && fnmatch (pattern, p->keyword, 0) == 0)
++ if (!p->prefix && (p->flags & XHDR_PROTECTED) && fnmatch (pattern, p->keyword, 0) == 0)
+ return true;
+ return false;
+ }
+@@ -511,7 +589,7 @@
+ struct xhdr_tab const *p;
+
+ for (p = xhdr_tab; p->keyword; p++)
+- if ((p->flags & XHDR_PROTECTED) && strcmp (p->keyword, keyword) == 0)
++ if (!p->prefix && (p->flags & XHDR_PROTECTED) && strcmp (p->keyword, keyword) == 0)
+ return true;
+ return false;
+ }
+@@ -1470,6 +1548,71 @@
+ }
+
+ static void
++xattr_selinux_coder (struct tar_stat_info const *st, char const *keyword,
++ struct xheader *xhdr, void const *data)
++{
++ code_string (st->cntx_name, keyword, xhdr);
++}
++
++static void
++xattr_selinux_decoder (struct tar_stat_info *st,
++ char const *keyword, char const *arg, size_t size)
++{
++ decode_string (&st->cntx_name, arg);
++}
++
++static void
++xattr_acls_a_coder (struct tar_stat_info const *st , char const *keyword,
++ struct xheader *xhdr, void const *data)
++{
++ xheader_print_n (xhdr, keyword, st->acls_a_ptr, st->acls_a_len);
++}
++
++static void
++xattr_acls_a_decoder (struct tar_stat_info *st,
++ char const *keyword, char const *arg, size_t size)
++{
++ st->acls_a_ptr = xmemdup (arg, size + 1);
++ st->acls_a_len = size;
++}
++
++static void
++xattr_acls_d_coder (struct tar_stat_info const *st , char const *keyword,
++ struct xheader *xhdr, void const *data)
++{
++ xheader_print_n (xhdr, keyword, st->acls_d_ptr, st->acls_d_len);
++}
++
++static void
++xattr_acls_d_decoder (struct tar_stat_info *st,
++ char const *keyword, char const *arg, size_t size)
++{
++ st->acls_d_ptr = xmemdup (arg, size + 1);
++ st->acls_d_len = size;
++}
++
++static void
++xattr_coder (struct tar_stat_info const *st , char const *keyword,
++ struct xheader *xhdr, void const *data)
++{
++ struct xattr_array *xattr_map = st->xattr_map;
++ const size_t *off = data;
++ xheader_print_n (xhdr, keyword,
++ xattr_map[*off].xval_ptr, xattr_map[*off].xval_len);
++}
++
++static void
++xattr_decoder (struct tar_stat_info *st,
++ char const *keyword, char const *arg, size_t size)
++{
++ char *xstr = NULL;
++
++ xstr = xmemdup(arg, size + 1);
++ xheader_xattr_add(st, keyword + strlen("SCHILY.xattr."), xstr, size);
++ free(xstr);
++}
++
++static void
+ sparse_major_coder (struct tar_stat_info const *st, char const *keyword,
+ struct xheader *xhdr, void const *data)
+ {
+@@ -1506,53 +1649,53 @@
+ }
+
+ struct xhdr_tab const xhdr_tab[] = {
+- { "atime", atime_coder, atime_decoder, 0 },
+- { "comment", dummy_coder, dummy_decoder, 0 },
+- { "charset", dummy_coder, dummy_decoder, 0 },
+- { "ctime", ctime_coder, ctime_decoder, 0 },
+- { "gid", gid_coder, gid_decoder, 0 },
+- { "gname", gname_coder, gname_decoder, 0 },
+- { "linkpath", linkpath_coder, linkpath_decoder, 0 },
+- { "mtime", mtime_coder, mtime_decoder, 0 },
+- { "path", path_coder, path_decoder, 0 },
+- { "size", size_coder, size_decoder, 0 },
+- { "uid", uid_coder, uid_decoder, 0 },
+- { "uname", uname_coder, uname_decoder, 0 },
++ { "atime", atime_coder, atime_decoder, 0, false },
++ { "comment", dummy_coder, dummy_decoder, 0, false },
++ { "charset", dummy_coder, dummy_decoder, 0, false },
++ { "ctime", ctime_coder, ctime_decoder, 0, false },
++ { "gid", gid_coder, gid_decoder, 0, false },
++ { "gname", gname_coder, gname_decoder, 0, false },
++ { "linkpath", linkpath_coder, linkpath_decoder, 0, false },
++ { "mtime", mtime_coder, mtime_decoder, 0, false },
++ { "path", path_coder, path_decoder, 0, false },
++ { "size", size_coder, size_decoder, 0, false },
++ { "uid", uid_coder, uid_decoder, 0, false },
++ { "uname", uname_coder, uname_decoder, 0, false },
+
+ /* Sparse file handling */
+ { "GNU.sparse.name", path_coder, path_decoder,
+- XHDR_PROTECTED },
++ XHDR_PROTECTED, false },
+ { "GNU.sparse.major", sparse_major_coder, sparse_major_decoder,
+- XHDR_PROTECTED },
++ XHDR_PROTECTED, false },
+ { "GNU.sparse.minor", sparse_minor_coder, sparse_minor_decoder,
+- XHDR_PROTECTED },
++ XHDR_PROTECTED, false },
+ { "GNU.sparse.realsize", sparse_size_coder, sparse_size_decoder,
+- XHDR_PROTECTED },
++ XHDR_PROTECTED, false },
+ { "GNU.sparse.numblocks", sparse_numblocks_coder, sparse_numblocks_decoder,
+- XHDR_PROTECTED },
++ XHDR_PROTECTED, false },
+
+ /* tar 1.14 - 1.15.90 keywords. */
+ { "GNU.sparse.size", sparse_size_coder, sparse_size_decoder,
+- XHDR_PROTECTED },
++ XHDR_PROTECTED, false },
+ /* tar 1.14 - 1.15.1 keywords. Multiple instances of these appeared in 'x'
+ headers, and each of them was meaningful. It confilcted with POSIX specs,
+ which requires that "when extended header records conflict, the last one
+ given in the header shall take precedence." */
+ { "GNU.sparse.offset", sparse_offset_coder, sparse_offset_decoder,
+- XHDR_PROTECTED },
++ XHDR_PROTECTED, false },
+ { "GNU.sparse.numbytes", sparse_numbytes_coder, sparse_numbytes_decoder,
+- XHDR_PROTECTED },
++ XHDR_PROTECTED, false },
+ /* tar 1.15.90 keyword, introduced to remove the above-mentioned conflict. */
+ { "GNU.sparse.map", NULL /* Unused, see pax_dump_header() */,
+- sparse_map_decoder, 0 },
++ sparse_map_decoder, 0, false },
+
+ { "GNU.dumpdir", dumpdir_coder, dumpdir_decoder,
+- XHDR_PROTECTED },
++ XHDR_PROTECTED, false },
+
+ /* Keeps the tape/volume label. May be present only in the global headers.
+ Equivalent to GNUTYPE_VOLHDR. */
+ { "GNU.volume.label", volume_label_coder, volume_label_decoder,
+- XHDR_PROTECTED | XHDR_GLOBAL },
++ XHDR_PROTECTED | XHDR_GLOBAL, false },
+
+ /* These may be present in a first global header of the archive.
+ They provide the same functionality as GNUTYPE_MULTIVOL header.
+@@ -1561,11 +1704,41 @@
+ GNU.volume.offset keeps the offset of the start of this volume,
+ otherwise kept in oldgnu_header.offset. */
+ { "GNU.volume.filename", volume_label_coder, volume_filename_decoder,
+- XHDR_PROTECTED | XHDR_GLOBAL },
++ XHDR_PROTECTED | XHDR_GLOBAL, false },
+ { "GNU.volume.size", volume_size_coder, volume_size_decoder,
+- XHDR_PROTECTED | XHDR_GLOBAL },
++ XHDR_PROTECTED | XHDR_GLOBAL, false },
+ { "GNU.volume.offset", volume_offset_coder, volume_offset_decoder,
+- XHDR_PROTECTED | XHDR_GLOBAL },
++ XHDR_PROTECTED | XHDR_GLOBAL, false },
++
++ /* We get the SELinux value from filecon, so add a namespace for SELinux
++ instead of storing it in SCHILY.xattr.* (which would be RAW). */
++ { "RHT.security.selinux",
++ xattr_selinux_coder, xattr_selinux_decoder, 0, false },
++
++ /* ACLs, use the star format... */
++ { "SCHILY.acl.access",
++ xattr_acls_a_coder, xattr_acls_a_decoder, 0, false },
++
++ { "SCHILY.acl.default",
++ xattr_acls_d_coder, xattr_acls_d_decoder, 0, false },
++
++ /* FIXME: These are compat. for FC-6 ... we shipped a tar using the generic
++ header names by accident. */
++ { "SCHILY.xattr.security.selinux",
++ xattr_selinux_coder, xattr_selinux_decoder, 0, false },
++ { "SCHILY.xattr.system.posix_acl_access",
++ xattr_acls_a_coder, xattr_acls_a_decoder, 0, false },
++ { "SCHILY.xattr.system.posix_acl_default",
++ xattr_acls_d_coder, xattr_acls_d_decoder, 0, false },
++
++ /* xattrs use the star format. note we only save some variants... */
++ { "SCHILY.xattr.user", xattr_coder, xattr_decoder, 0, true },
++ { "SCHILY.xattr.trusted", xattr_coder, xattr_decoder, 0, true },
++ { "SCHILY.xattr.lustre", xattr_coder, xattr_decoder, 0, true },
++ { "SCHILY.xattr.security.NTACL", xattr_coder, xattr_decoder, 0, true },
++
++ /* ignore everything else in the xattr namespaces... */
++ { "SCHILY.xattr", dummy_coder, dummy_decoder, 0, true },
+
+- { NULL, NULL, NULL, 0 }
++ { NULL, NULL, NULL, 0, false }
+ };
diff --git a/app-arch/tar/files/tar.1 b/app-arch/tar/files/tar.1
new file mode 100644
index 0000000..42fd22f
--- /dev/null
+++ b/app-arch/tar/files/tar.1
@@ -0,0 +1,816 @@
+.TH TAR 1 "Mar 2010" "GNU" "tar"
+.SH NAME
+tar \- The GNU version of the tape archiver (tar) utility
+.SH SYNOPSIS
+.B tar
+.I <operation> [options]
+
+.I Operations:
+.nf
+.B [-]A --catenate --concatenate
+.B [-]c --create
+.B [-]d --diff --compare
+.B [-]r --append
+.B [-]t --list
+.B [-]u --update
+.B [-]x --extract --get
+.B --delete
+.fi
+
+.I Common Options:
+.nf
+.BR -C ", " --directory " DIR"
+.BR -f ", " --file " FILE"
+.BR -j ", " --bzip2
+.BR -J ", " --xz
+.BR -p ", " --preserve-permissions
+.BR -v ", " --verbose
+.BR -z ", " --gzip
+.fi
+
+.I All Options:
+.br
+[
+.BR -a ", " --auto-compress
+]
+[
+.BR --add-file " FILE"
+]
+[
+.BR --anchored
+]
+[
+.BR --atime-preserve
+]
+[
+.BR -b ", " --blocking-factor " N"
+]
+[
+.BR -B ", " --read-full-records
+]
+[
+.BR --backup " BACKUP-TYPE"
+]
+[
+.BR --block-compress
+]
+[
+.BR -C ", " --directory " DIR"
+]
+[
+.BR --checkpoint
+]
+[
+.BR --delay-directory-restore
+]
+[
+.BR --exclude " PATTERN"
+]
+[
+.BR --exclude-caches
+]
+[
+.BR --exclude-caches-all
+]
+[
+.BR --exclude-caches-under
+]
+[
+.BR --exclude-tag " FILE"
+]
+[
+.BR --exclude-tag-all " FILE"
+]
+[
+.BR --exclude-tag-under " FILE"
+]
+[
+.BR -f ", " --file " [HOSTNAME:]FILE"
+]
+[
+.BR -F ", " --info-script " FILE, " --new-volume-script " FILE"
+]
+[
+.BR --force-local
+]
+[
+.BR --format " FORMAT"
+]
+[
+.BR -g ", " --listed-incremental " SNAPSHOT"
+]
+[
+.BR -G ", " --incremental
+]
+[
+.BR --group " GROUP"
+]
+[
+.BR -h ", " --dereference
+]
+[
+.BR --help
+]
+[
+.BR -i ", " --ignore-zeros
+]
+[
+.BR -I ", " --use-compress-program " PROG"
+]
+[
+.BR --ignore-case
+]
+[
+.BR --ignore-command-error
+]
+[
+.BR --ignore-failed-read
+]
+[
+.BR --index-file " FILE"
+]
+[
+.BR -j ", " --bzip2
+]
+[
+.BR -J ", " --xz
+]
+[
+.BR -k ", " --keep-old-files
+]
+[
+.BR -K ", " --starting-file " FILE"
+]
+[
+.BR --keep-newer-files
+]
+[
+.BR -l ", " --check-links
+]
+[
+.BR -L ", " --tape-length " N"
+]
+[
+.BR --lzip
+]
+[
+.BR --lzma
+]
+[
+.BR --lzop
+]
+[
+.BR -m ", " --touch ", " --modification-time
+]
+[
+.BR -M ", " --multi-volume
+]
+[
+.BR --mode " PERMISSIONS"
+]
+[
+.BR --mtime " DATE"
+]
+[
+.BR -N ", " --after-date " DATE, " --newer " DATE"
+]
+[
+.BR --newer-mtime " DATE"
+]
+[
+.BR --no-anchored
+]
+[
+.BR --no-auto-compress
+]
+[
+.BR --no-delay-directory-restore
+]
+[
+.BR --no-ignore-case
+]
+[
+.BR --no-ignore-command-error
+]
+[
+.BR --no-overwrite-dir
+]
+[
+.BR --no-quote-chars
+]
+[
+.BR --no-recursion
+]
+[
+.BR --no-same-permissions
+]
+[
+.BR --no-unquote
+]
+[
+.BR --no-wildcards
+]
+[
+.BR --no-wildcards-match-slash
+]
+[
+.BR --null
+]
+[
+.BR --numeric-owner
+]
+[
+.BR -o ", " --old-archive ", " --portability ", " --no-same-owner
+]
+[
+.BR -O ", " --to-stdout
+]
+[
+.BR --occurrence " NUM"
+]
+[
+.BR --one-file-system
+]
+[
+.BR --overwrite
+]
+[
+.BR --overwrite-dir
+]
+[
+.BR --owner " USER"
+]
+[
+.BR -p ", " --same-permissions ", " --preserve-permissions
+]
+[
+.BR -P ", " --absolute-names
+]
+[
+.BR --pax-option " KEYWORD-LIST"
+]
+[
+.BR --posix
+]
+[
+.BR --preserve
+]
+[
+.BR --quote-chars " STRING"
+]
+[
+.BR --quote-style " STYLE"
+]
+[
+.BR -R ", " --block-number
+]
+[
+.BR --record-size " SIZE"
+]
+[
+.BR --recursion
+]
+[
+.BR --recursive-unlink
+]
+[
+.BR --remove-files
+]
+[
+.BR --restrict
+]
+[
+.BR --rmt-command " CMD"
+]
+[
+.BR --rsh-command " CMD"
+]
+[
+.BR -s ", " --same-order ", " --preserve-order
+]
+[
+.BR -S ", " --sparse
+]
+[
+.BR --same-owner
+]
+[
+.BR --show-defaults
+]
+[
+.BR --show-omitted-dirs
+]
+[
+.BR --show-transformed-names ", " --show-stored-names
+]
+[
+.BR --strip-components " NUMBER"
+]
+[
+.BR --suffix " SUFFIX"
+]
+[
+.BR -T ", " --files-from " FILE"
+]
+[
+.BR --test-label
+]
+[
+.BR --to-command " COMMAND"
+]
+[
+.BR --transform " EXPRESSION"
+]
+[
+.BR --totals
+]
+[
+.BR -U ", " --unlink-first
+]
+[
+.BR --unquote
+]
+[
+.BR --utc
+]
+[
+.BR -v ", " --verbose
+]
+[
+.BR -V ", " --label " NAME"
+]
+[
+.BR --version
+]
+[
+.BR --volno-file " FILE"
+]
+[
+.BR -w ", " --interactive ", " --confirmation
+]
+[
+.BR -W ", " --verify
+]
+[
+.BR --wildcards
+]
+[
+.BR --wildcards-match-slash
+]
+[
+.BR -X ", " --exclude-from " FILE"
+]
+[
+.BR -z ", " --gzip ", " --gunzip ", " --ungzip
+]
+[
+.BR -Z ", " --compress ", " --uncompress
+]
+[
+.BR -[0-7][lmh]
+]
+.SH DESCRIPTION
+This manual page documents the GNU version of \fBtar\fR, an archiving
+program designed to store and extract files from an archive file known
+as a \fItarfile\fR. A \fItarfile\fR may be made on a tape drive,
+however, it is also common to write a \fItarfile\fR to a normal file.
+The first argument to \fBtar\fR must be one of the options \fBAcdrtux\fR,
+followed by any optional functions. The final arguments to \fBtar\fR
+are the names of the files or directories which should be archived. The
+use of a directory name always implies that the subdirectories below
+should be included in the archive.
+.SH EXAMPLES
+.TP
+.B tar -xvf foo.tar
+verbosely extract foo.tar
+.TP
+.B tar -xzf foo.tar.gz
+extract gzipped foo.tar.gz
+.TP
+.B tar -cjf foo.tar.bz2 bar/
+create bzipped tar archive of the directory bar called foo.tar.bz2
+.TP
+.B tar -xjf foo.tar.bz2 -C bar/
+extract bzipped foo.tar.bz2 after changing directory to bar
+.TP
+.B tar -xzf foo.tar.gz blah.txt
+extract the file blah.txt from foo.tar.gz
+.P
+Note: When working with archives, specifying the compression option is often
+times unnecessary as \fBtar\fR will automatically detect the compression type
+based on the suffix of the archive.
+.SH "FUNCTION LETTERS"
+.TP
+.B One of the following options must be used:
+.TP
+.BR -A ", " --catenate ", " --concatenate
+append tar files to an archive
+.TP
+.BR -c ", " --create
+create a new archive
+.TP
+.BR -d ", " --diff ", " --compare
+find differences between archive and file system
+.TP
+.BR -r ", " --append
+append files to the end of an archive
+.TP
+.BR -t ", " --list
+list the contents of an archive
+.TP
+.BR -u ", " --update
+only append files that are newer than the existing in archive
+.TP
+.BR -x ", " --extract ", " --get
+extract files from an archive
+.TP
+.BR --delete
+delete from the archive (not for use on magnetic tapes!)
+.SH "COMMON OPTIONS"
+.TP
+.BR -C ", " --directory " DIR"
+change to directory DIR
+.TP
+.BR -f ", " --file " [HOSTNAME:]FILE"
+use archive file or device FILE (default is "-", meaning stdin/stdout)
+.TP
+.BR -j ", " --bzip2
+filter archive through bzip2; use to decompress .bz2 files
+.TP
+.BR -J ", " --xz
+filter archive through xz; use to decompress .xz files
+.TP
+.BR -p ", " --preserve-permissions
+extract all protection information
+.TP
+.BR -v ", " --verbose
+verbosely list files processed
+.TP
+.BR -z ", " --gzip ", " --ungzip
+filter the archive through gzip
+.SH "ALL OPTIONS"
+.TP
+.BR -a ", " --auto-compress
+use archive suffix to determine the compression program
+.TP
+.BR --add-file " FILE"
+add specified FILE to the archive (useful if FILE starts with a dash)
+.TP
+.BR --anchored
+patterns will match the start of file names
+.TP
+.BR --atime-preserve
+don't change access times of files that are archived
+.TP
+.BR -b ", " --blocking-factor " N"
+block size of Nx512 bytes (default N=20)
+.TP
+.BR -B ", " --read-full-blocks
+reblock as we read (for reading 4.2BSD pipes)
+.TP
+.BR --backup " BACKUP-TYPE"
+backup files instead of deleting them using BACKUP-TYPE simple or
+numbered
+.TP
+.BR --block-compress
+block the output of compression program for tapes
+.TP
+.BR -C ", " --directory " DIR"
+change to directory DIR
+.TP
+.BR --checkpoint
+print directory names while reading the archive
+.TP
+.BR --delay-directory-restore
+delay setting modification times and permissions of extracted directories
+until the end of extraction
+.TP
+.BR --exclude " PATTERN"
+exclude files based upon PATTERN
+.TP
+.BR --exclude-caches
+exclude directories that contain a cache directory tag
+.TP
+.BR --exclude-tag " FILE"
+exclude directories that contain a file named FILE
+.TP
+.BR -f ", " --file " [HOSTNAME:]FILE"
+use archive file or device FILE (default "-", meaning stdin/stdout)
+.TP
+.BR -F ", " --info-script " FILE, " --new-volume-script " FILE"
+run script at end of each tape (implies \fI--multi-volume\fR)
+.TP
+.BR --force-local
+archive file is local even if its name contains a colon
+.TP
+.BR --format " FORMAT"
+selects the format of the created archive
+.nf
+\fIv7\fR - Unix V7
+\fIoldgnu\fR - GNU tar <=1.12
+\fIgnu\fR - GNU tar 1.13
+\fIustar\fR - POSIX.1-1988
+\fIposix\fR - POSIX.1-2001
+.fi
+.TP
+.BR -g ", " --listed-incremental " SNAPSHOT"
+create/list/extract new GNU-format incremental backup
+.TP
+.BR --group " GROUP"
+give files added to the archive a group id of GROUP instead of the group id
+of the source file; this option does not affect extraction
+.TP
+.BR -G ", " --incremental
+create/list/extract old GNU-format incremental backup
+.TP
+.BR -h ", " --dereference
+don't archive symlinks; archive the files they point to
+.TP
+.BR --help
+like this manpage, but not as cool
+.TP
+.BR -i ", " --ignore-zeros
+ignore blocks of zeros in archive (normally mean EOF)
+.TP
+.BR -I ", " --use-compress-program " PROG"
+access the archive through PROG (which is generally a compression program;
+it must accept the \fI-d\fR option)
+.TP
+.BR --ignore-case
+ignore case when excluding files
+.TP
+.BR --ignore-command-error
+ignore exit codes of subprocesses
+.TP
+.BR --ignore-failed-read
+don't exit with non-zero status on unreadable files
+.TP
+.BR --index-file " FILE"
+send verbose output to FILE instead of stdout
+.TP
+.BR -j ", " --bzip2
+filter archive through bzip2, use to decompress .bz2 files
+.TP
+.BR -J ", " --xz
+filter archive through xz; use to decompress .xz files
+.TP
+.BR -k ", " --keep-old-files
+keep existing files; don't overwrite them from archive
+.TP
+.BR -K ", " --starting-file " FILE"
+begin at file FILE in the archive
+.TP
+.BR --keep-newer-files
+do not overwrite files which are newer than the archive
+.TP
+.BR -l ", " --check-links
+warn if number of hard links to the file on the filesystem mismatchs
+the number of links recorded in the archive
+.TP
+.BR -L ", " --tape-length " N"
+change tapes after writing N*1024 bytes
+.TP
+.BR -m ", " --touch ", " --modification-time
+don't extract file modified time
+.TP
+.BR -M ", " --multi-volume
+create/list/extract multi-volume archive
+.TP
+.BR --mode " PERMISSIONS"
+apply PERMISSIONS while adding files (see \fBchmod\fR(1))
+.TP
+.BR --mtime " DATE"
+when creating archives, use DATE as the modification time of the members,
+instead of their actual modification times
+.TP
+.BR -N ", " --after-date " DATE, " --newer " DATE"
+only store files that were modified or had status updates (permissions,
+ACLs, extended attributes, ...) since DATE
+.TP
+.BR --newer-mtime " DATE"
+like \fI--newer\fR, but only store files that were modified since DATE
+.TP
+.BR --no-anchored
+match any subsequenceof the name's components with \fI--exclude\fR
+.TP
+.BR --no-auto-compress
+do not use archive suffix to determine the compression program
+.TP
+.BR --no-delay-directory-restore
+modification times and permissions of extracted directories are set when
+all files from this directory have been extracted; this is the default
+.TP
+.BR --no-ignore-command-error
+print warnings about subprocesses that terminated with a non-zero exit code
+.TP
+.BR --no-ignore-case
+use case-sensitive matching with \fI--exclude\fR
+.TP
+.BR --no-overwrite-dir
+preserve metadata of existing directories when extracting files from an
+archive
+.TP
+.BR --no-quote-chars " STRING"
+remove characters listed in STRING from the list of quoted characters
+set by a previous \fI--quote-chars\fR option
+.TP
+.BR --no-recursion
+don't recurse into directories
+.TP
+.BR --no-same-permissions
+apply user's umask when extracting files instead of recorded permissions
+.TP
+.BR --no-unquote
+treat all input file or member names literally, do not interpret
+escape sequences
+.TP
+.BR --no-wildcards
+don't use wildcards with \fI--exclude\fR
+.TP
+.BR --no-wildcards-match-slash
+wildcards do not match slashes (/) with \fI--exclude\fR
+.TP
+.BR --null
+\fI--files-from\fR reads null-terminated names, disable \fI--directory\fR
+.TP
+.BR --numeric-owner
+always use numbers for user/group names
+.TP
+.BR -o ", " --old-archive ", " --portability
+like \fI--format=v7\fR; \fI-o\fR exhibits this behavior when creating an
+archive (deprecated behavior)
+.TP
+.BR -o ", " --no-same-owner
+do not attempt to restore ownership when extracting; \fI-o\fR exhibits
+this behavior when extracting an archive
+.TP
+.BR -O ", " --to-stdout
+extract files to standard output
+.TP
+.BR --occurrence " NUM"
+process only NUM occurrences of each named file; used with
+\fI--delete\fR, \fI--diff\fR, \fI--extract\fR, or \fI--list\fR
+.TP
+.BR --one-file-system
+stay in local file system when creating an archive
+.TP
+.BR --one-file-system
+stay in local file system when creating an archive
+.TP
+.BR --overwrite
+overwrite existing files and directory metadata when extracting
+.TP
+.BR --overwrite-dir
+overwrite directory metadata when extracting
+.TP
+.BR --owner " USER"
+give files added to the archive a user id of USER instead of the user id
+of the source file; this option does not affect extraction
+.TP
+.BR -p ", " --preserve-permissions ", " --same-permissions
+extract all protection information
+.TP
+.BR -P ", " --absolute-names
+don't strip leading `/'s from file names
+.TP
+.BR --pax-option " KEYWORD-LIST"
+used only with POSIX.1-2001 archives to modify the way \fBtar\fR handles
+extended header keywords
+.TP
+.BR --posix
+like \fI--format=posix\fR
+.TP
+.BR --preserve
+like \fI--preserve-permissions\fR plus \fI--same-order\fR
+.TP
+.BR --quote-chars " STRING"
+always quote the characters from STRING, even if the selected quoting
+style would not quote them
+.TP
+.BR --quote-style " STYLE"
+set the quoting style to be used when printing member and file names
+.TP
+.BR -R ", " --record-number
+show record number within archive with each message
+.TP
+.BR --record-size " SIZE"
+use SIZE bytes per record when accessing archives
+.TP
+.BR --recursion
+recurse into directories
+.TP
+.BR --recursive-unlink
+remove existing directories before extracting directories of the same name
+.TP
+.BR --remove-files
+remove files after adding them to the archive
+.TP
+.BR --restrict
+disable the use of some potentially harmful options; currently this
+disables shell invocation from the multi-volume menu
+.TP
+.BR --rmt-command " CMD"
+use CMD instead of the default /usr/sbin/rmt
+.TP
+.BR --rsh-command " CMD"
+use remote CMD instead of \fBrsh\fR(1)
+.TP
+.BR -s ", " --same-order ", " --preserve-order
+list of names to extract is sorted to match archive
+.TP
+.BR -S ", " --sparse
+handle sparse files efficiently
+.TP
+.BR --same-owner
+create extracted files with the same ownership
+.TP
+.BR --show-defaults
+display the default options used by \fBtar\fR
+.TP
+.BR --show-omitted-dirs
+print directories \fBtar\fR skips while operating on an archive
+.TP
+.BR --show-transformed-names ", " --show-stored-names
+display file or member names after applying any \fBsed\fR transformations
+.TP
+.BR --strip-components " NUMBER"
+strip NUMBER of leading path components from file names before extraction
+.TP
+.BR --suffix " SUFFIX"
+use SUFFIX instead of default '~' when backing up files
+.TP
+.BR -T ", " --files-from " FILE"
+get names to extract or create from file FILE
+.TP
+.BR --test-label
+read the volume label; if an argument is specified, test whether it
+matches the volume label
+.TP
+.BR --to-command " COMMAND"
+during extraction, pipe extracted files to the standard input of COMMAND
+.TP
+.BR --totals
+print total bytes written with --create
+.TP
+.BR --transform " EXPRESSION"
+transform file or member names using the \fBsed\fR replacement expression
+EXPRESSION
+.TP
+.BR -U ", " --unlink-first
+remove existing files before extracting files of the same name
+.TP
+.BR --unquote
+enable unquoting input file or member names; this is the default
+.TP
+.BR --utc
+display file modification dates in UTC
+.TP
+.BR -v ", " --verbose
+verbosely list files processed
+.TP
+.BR -V ", " --label " NAME"
+create archive with volume name NAME
+.TP
+.BR --version
+print \fBtar\fR program version number
+.TP
+.BR --volno-file " FILE"
+keep track of which volume of a multi-volume archive its working in
+FILE; used with \fI--multi-volume\fR
+.TP
+.BR -w ", " --interactive ", " --confirmation
+ask for confirmation for every action
+.TP
+.BR -W ", " --verify
+attempt to verify the archive after writing it
+.TP
+.BR --wildcards
+use wildcards with \fI--exclude\fR
+.TP
+.BR --wildcards-match-slash
+wildcards match slashes (/) with \fI--exclude\fR
+.TP
+.BR -X ", " --exclude-from " FILE"
+exclude files listed in FILE
+.TP
+.BR -z ", " --gzip ", " --gunzip ", " --ungzip
+filter the archive through gzip
+.TP
+.BR -Z ", " --compress ", " --uncompress
+filter the archive through compress
+.TP
+.BR -[0-7][lmh]
+specify drive and density
+.SH BUGS
+The GNU folks, in general, abhor man pages and create info documents instead.
+The maintainer of \fBtar\fR falls into this category. Thus, this man page may
+not be complete nor current, and it is included in the Gentoo portage tree
+because man is a great tool :). This man page was first taken from Debian
+Linux and has since been lovingly updated here.
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH "AUTHORS"
+.nf
+Debian Linux http://www.debian.org/
+Mike Frysinger <vapier@gentoo.org>
+.fi
diff --git a/app-arch/tar/metadata.xml b/app-arch/tar/metadata.xml
new file mode 100644
index 0000000..96a2d58
--- /dev/null
+++ b/app-arch/tar/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/app-arch/tar/tar-1.26-r1.ebuild b/app-arch/tar/tar-1.26-r1.ebuild
new file mode 100644
index 0000000..7589bbf
--- /dev/null
+++ b/app-arch/tar/tar-1.26-r1.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-arch/tar/tar-1.26.ebuild,v 1.1 2011/03/13 20:46:42 vapier Exp $
+
+EAPI="3"
+
+inherit autotools flag-o-matic
+
+DESCRIPTION="Use this to make tarballs :)"
+HOMEPAGE="http://www.gnu.org/software/tar/"
+SRC_URI="http://ftp.gnu.org/gnu/tar/${P}.tar.bz2
+ ftp://alpha.gnu.org/gnu/tar/${P}.tar.bz2
+ mirror://gnu/tar/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="nls static userland_GNU xattr"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ nls? ( >=sys-devel/gettext-0.10.35 )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-xattr.patch #382067
+ eautoreconf
+
+ if ! use userland_GNU ; then
+ sed -i \
+ -e 's:/backup\.sh:/gbackup.sh:' \
+ scripts/{backup,dump-remind,restore}.in \
+ || die "sed non-GNU"
+ fi
+}
+
+src_configure() {
+ local myconf
+ use static && append-ldflags -static
+ use userland_GNU || myconf="--program-prefix=g"
+ # Work around bug in sandbox #67051
+ gl_cv_func_chown_follows_symlink=yes \
+ FORCE_UNSAFE_CONFIGURE=1 \
+ econf \
+ --enable-backup-scripts \
+ --bindir="${EPREFIX}"/bin \
+ --libexecdir="${EPREFIX}"/usr/sbin \
+ $(use_enable nls) \
+ $(use_enable xattr selinux)
+ ${myconf}
+}
+
+src_install() {
+ local p=""
+ use userland_GNU || p=g
+
+ emake DESTDIR="${D}" install || die
+
+ if [[ -z ${p} ]] ; then
+ # a nasty yet required piece of baggage
+ exeinto /etc
+ doexe "${FILESDIR}"/rmt || die
+ fi
+
+ # autoconf looks for gtar before tar (in configure scripts), hence
+ # in Prefix it is important that it is there, otherwise, a gtar from
+ # the host system (FreeBSD, Solaris, Darwin) will be found instead
+ # of the Prefix provided (GNU) tar
+ if use prefix ; then
+ dosym tar /bin/gtar
+ fi
+
+ dodoc AUTHORS ChangeLog* NEWS README* THANKS
+ newman "${FILESDIR}"/tar.1 ${p}tar.1
+ mv "${ED}"/usr/sbin/${p}backup{,-tar}
+ mv "${ED}"/usr/sbin/${p}restore{,-tar}
+}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] dev/blueness:master commit in: app-arch/tar/files/, app-arch/tar/
@ 2011-09-24 17:33 Anthony G. Basile
0 siblings, 0 replies; 4+ messages in thread
From: Anthony G. Basile @ 2011-09-24 17:33 UTC (permalink / raw
To: gentoo-commits
commit: fffbe9db6f3f86af5556ac989873df2195926f0c
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 24 17:32:22 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Sep 24 17:32:22 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/blueness.git;a=commit;h=fffbe9db
Switching to USE=xattr for xattr only patch - bug #382067
(Portage version: 2.1.10.11/git/Linux x86_64, signed Manifest commit with key 0xD0455535)
---
app-arch/tar/ChangeLog | 6 +
app-arch/tar/Manifest | 12 +-
app-arch/tar/files/tar-1.26-xattr.patch | 944 +++-----------------
.../tar/{tar-1.26-r1.ebuild => tar-1.26-r2.ebuild} | 4 +-
4 files changed, 154 insertions(+), 812 deletions(-)
diff --git a/app-arch/tar/ChangeLog b/app-arch/tar/ChangeLog
index 8b65fa4..5d2729f 100644
--- a/app-arch/tar/ChangeLog
+++ b/app-arch/tar/ChangeLog
@@ -1,5 +1,11 @@
+*tar-1.26-r2 (24 Sep 2011)
+
+ 24 Sep 2011; Anthony G. Basile <blueness@gentoo.org> -tar-1.26-r1.ebuild,
+ +tar-1.26-r2.ebuild, files/tar-1.26-xattr.patch:
+ Switching to USE="xattr" for xattr only patch - bug #382067
+
10 Sep 2011; Anthony G. Basile <blueness@gentoo.org> tar-1.26-r1.ebuild:
Switching to USE="selinux"
diff --git a/app-arch/tar/Manifest b/app-arch/tar/Manifest
index a739bfa..2ecc9c3 100644
--- a/app-arch/tar/Manifest
+++ b/app-arch/tar/Manifest
@@ -2,16 +2,16 @@
Hash: SHA256
AUX rmt 263 RMD160 c5d680ef166b8afda1e78cb5c7d1b47cdb6c99df SHA1 43b791b49aa06e151b90e8e91e3287af3259a62a SHA256 c0371cb0243a190b6bb43609c86dfb4cd637882d4ff3ff9651ca7ec8d6b59355
-AUX tar-1.26-xattr.patch 49745 RMD160 edf35cd3de8fbc65568abeb39b9adcc086b6b503 SHA1 6932ff1a0a47b524fa29b142717410c68f3bc455 SHA256 6ecbb2586db8937a03ddff393c79c0bdf070d2ecb264c704702da14e221eee9e
+AUX tar-1.26-xattr.patch 30674 RMD160 d24c88a738bee992c53c9fed469c93fff90ede2c SHA1 5fd7dcd43adb5812254d684e6ddafd113d1877f7 SHA256 c91bdb1c434fb71a1aa7df3d87466010a32a9f6293dba466c3a5401c2cc6a4db
AUX tar.1 16821 RMD160 f58bc7cfeeee0cc811a6c2b5dd1dffe8b197231e SHA1 b354f0803c03cd59fe24f93d532f27f6f0136316 SHA256 f3558b444ab9427c06bc92838c29194051ed64edd0a909163cfa715cc7e6dcdd
DIST tar-1.26.tar.bz2 2339773 RMD160 d507dc5a57a823701cae5cdd2b98aba48ec74d3f SHA1 70f298c3cd997b694864c55e6d8655324c87a0cc SHA256 5a5369f464502a598e938029c310d4b3abd51e6bb8dfd045663e61c8ea9f6d41
-EBUILD tar-1.26-r1.ebuild 2195 RMD160 aa30ddb4b4096850541659f5d5c8a61d31f7780a SHA1 9828415bec8d7cb3a4e195ed5926c5a51578e675 SHA256 8091e297acde598674f18e5a19610ce11fdc0c528ad93c9857ec94bb2d67cd45
-MISC ChangeLog 293 RMD160 55c8a6d3f1fe7106af32c7a186df069378e658f9 SHA1 a44267a6e91697dcc8f25a0a29f76d77fe4cfb0e SHA256 52b9b71ec0e99ad4838139e0e0adcdb55a2914ccc32051329dd5a24db4d99308
+EBUILD tar-1.26-r2.ebuild 2191 RMD160 25ccbf49526eafd77ed3e712a7247b814a30658a SHA1 e5e864d1ba573b19bf1bc78205adc0e03dfa7c8d SHA256 48dd8230bf637d02b9b6e1cdc0307c04f915c05d9aeee09cfde51c5bbb431868
+MISC ChangeLog 511 RMD160 372a29f855c10e98e5a6a18f2da5963fa6ea021b SHA1 d644b6856e38d1194f18d6d0fcb36975798f6f49 SHA256 7279a303ba9bd4623b1296caa8036836d948060d840cc28ff23a47cba32dcf49
MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
-iEYEAREIAAYFAk5rdF8ACgkQl5yvQNBFVTWEzQCfQQnFf0LTB95eezwvOFZYTHkd
-+9AAniswisrX2fb5wLNQWGZNd4a862RR
-=QECv
+iEYEAREIAAYFAk5+FCYACgkQl5yvQNBFVTXj2wCdEaiNZKbO+GIL1uStY/sZVKZ9
+K7kAoIe/b8PDL6StwnWtsS5O2NedavF3
+=ufJW
-----END PGP SIGNATURE-----
diff --git a/app-arch/tar/files/tar-1.26-xattr.patch b/app-arch/tar/files/tar-1.26-xattr.patch
index 91d56ac..7a5c7f8 100644
--- a/app-arch/tar/files/tar-1.26-xattr.patch
+++ b/app-arch/tar/files/tar-1.26-xattr.patch
@@ -1,126 +1,55 @@
-diff -Naur tar-1.26.orig//configure.ac tar-1.26/configure.ac
---- tar-1.26.orig//configure.ac 2011-03-12 04:47:13.000000000 -0500
-+++ tar-1.26/configure.ac 2011-09-07 06:13:38.000000000 -0400
-@@ -44,7 +44,7 @@
- sys/param.h sys/device.h sys/gentape.h \
- sys/inet.h sys/io/trioctl.h \
- sys/mtio.h sys/time.h sys/tprintf.h sys/tape.h \
-- unistd.h locale.h)
-+ unistd.h locale.h attr/xattr.h sys/acl.h)
-
- AC_CHECK_HEADERS([sys/buf.h], [], [],
- [#if HAVE_SYS_PARAM_H
-@@ -91,6 +91,12 @@
- tar_PAXUTILS
-
- AC_CHECK_FUNCS_ONCE([fchmod fchown fsync lstat mkfifo readlink symlink])
-+AC_CHECK_FUNCS(getxattr fgetxattr lgetxattr \
-+ setxattr fsetxattr lsetxattr \
-+ listxattr flistxattr llistxattr,
-+ AC_DEFINE(HAVE_XATTRS,,[Define if we have a working extended attributes]),)
-+AC_CHECK_LIB(acl, acl_get_fd)
-+
- AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
- AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
- AC_CHECK_DECLS([time],,, [#include <time.h>])
-@@ -214,6 +220,7 @@
- # Iconv
- AM_ICONV
- AC_CHECK_HEADERS(iconv.h)
-+AC_CHECK_HEADERS(attr/xattr.h)
- AC_CHECK_TYPE(iconv_t,:,
- AC_DEFINE(iconv_t, int,
- [Conversion descriptor type]),
-@@ -223,6 +230,17 @@
+diff --git a/configure.ac b/configure.ac
+index db69cb8..2afa463 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -223,6 +223,20 @@ AC_CHECK_TYPE(iconv_t,:,
#endif
])
-+AC_ARG_ENABLE(selinux,
-+ AC_HELP_STRING([--enable-selinux],
-+ [enable SELinux support (disabled by default)]),
-+ [selinux_enabled=$enableval],
-+ [selinux_enabled=no])
-+
-+if test "x$selinux_enabled" = xyes; then
-+ AC_CHECK_LIB(selinux, getfilecon)
-+ AC_CHECK_HEADERS(selinux/selinux.h)
++AC_ARG_ENABLE(xattr,
++ AC_HELP_STRING([--enable-xattr],
++ [enable Extended Attribute support (disabled by default)]),
++ [xattr_enabled=$enableval],
++ [xattr_enabled=no])
++
++if test "x$xattr_enabled" = xyes; then
++ AC_CHECK_HEADERS(attr/xattr.h)
++ AC_CHECK_FUNCS(getxattr fgetxattr lgetxattr \
++ setxattr fsetxattr lsetxattr \
++ listxattr flistxattr llistxattr,
++ AC_DEFINE(HAVE_XATTRS,1,[Define if we have a working extended attributes]),)
+fi
+
# Gettext.
AM_GNU_GETTEXT([external], [need-formatstring-macros])
AM_GNU_GETTEXT_VERSION([0.16])
-diff -Naur tar-1.26.orig//doc/tar.texi tar-1.26/doc/tar.texi
---- tar-1.26.orig//doc/tar.texi 2011-03-12 04:09:33.000000000 -0500
-+++ tar-1.26/doc/tar.texi 2011-09-07 06:13:38.000000000 -0400
-@@ -2369,6 +2369,10 @@
- @samp{/} from member names. This option disables that behavior.
- @xref{absolute}.
-
-+@opsummary{acl}
-+@item --acls
-+Causes @command{tar} to store ACL's. @xref{Attributes}.
-+
- @opsummary{after-date}
- @item --after-date
-
-@@ -2914,6 +2918,10 @@
- also back up files for which any status information has
- changed). @xref{after}.
-
-+@opsummary{no-acl}
-+@item --no-acls
-+Causes @command{tar} not to store and not to extract ACL's. @xref{Attributes}.
-+
- @opsummary{no-anchored}
- @item --no-anchored
- An exclude pattern can match any subsequence of the name's components.
-@@ -2997,11 +3005,21 @@
- 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 and not to extract SELinux security context.
-+@xref{Attributes}.
-+
- @opsummary{no-unquote}
- @item --no-unquote
+diff --git a/doc/tar.texi b/doc/tar.texi
+index db8f986..d861d12 100644
+--- a/doc/tar.texi
++++ b/doc/tar.texi
+@@ -3002,6 +3002,10 @@ mechanism.
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 and not to extract xattrs. This option also
-+enables @option{--no-selinux} and @option{--no-acls}. @xref{Attributes}.
++Causes @command{tar} not to store and not to extract xattrs. @xref{Attributes}.
+
@opsummary{no-wildcards}
@item --no-wildcards
Do not use wildcards.
-@@ -3234,6 +3252,11 @@
- archive is open for reading (e.g. with @option{--list} or
- @option{--extract} options).
-
-+@opsummary{selinux}
-+@item --selinux
-+Causes @command{tar} to store SElinux security context. @xref{Attributes}.
-+
-+
- @opsummary{show-defaults}
- @item --show-defaults
-
-@@ -3447,6 +3470,11 @@
+@@ -3447,6 +3451,10 @@ 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 xattrs. This option also enables
-+@option{--selinux} and @option{--acls}. @xref{Attributes}.
++Causes @command{tar} to store xattrs. @xref{Attributes}.
+
@opsummary{wildcards}
@item --wildcards
Use wildcards when matching member names with patterns.
-@@ -8659,6 +8687,8 @@
+@@ -8659,6 +8667,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.
@@ -129,78 +58,69 @@ diff -Naur tar-1.26.orig//doc/tar.texi tar-1.26/doc/tar.texi
This archive format will be the default format for future versions
of @GNUTAR{}.
-@@ -9293,6 +9323,51 @@
+@@ -9293,6 +9303,20 @@ Same as both @option{--same-permissions} and @option{--same-order}.
This option is deprecated, and will be removed in @GNUTAR{} version 1.23.
-+@opindex acls
-+@item --acls
-+This option causes @command{tar} to store the current ACL in the archive.
-+
-+The @option{--acls} option has no equivalent short option name.
-+
-+@opindex selinux
-+@item --selinux
-+This option causes @command{tar} to store the current SELinux security context
-+information in the archive.
-+
-+The @option{--selinux} option has no equivalent short option name.
-+
+@opindex xattrs
+@item --xattrs
+This option causes @command{tar} to store the current extended attributes in
-+the archive. This option also enables @option{--acls} and @option{--selinux} if
-+they haven't been set already.
++the archive.
+
+The @option{--xattrs} option has no equivalent short option name.
+
-+@opindex no-acls
-+@item --no-acls
-+This option causes @command{tar} not to store the current ACL in the archive
-+and not to extract any ACL information in an archive.
-+
-+The @option{--no-acls} 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 no-xattrs
+@item --no-xattrs
+This option causes @command{tar} not to store the current extended attributes in
-+the archive and not to extract any extended attributes in an archive. This
-+option also enables @option{--no-acls} and @option{--no-selinux} if
-+they haven't been set already.
++the archive and not to extract any extended attributes in an archive.
+
+The @option{--no-xattrs} option has no equivalent short option name.
+
@end table
@node Portability
-diff -Naur tar-1.26.orig//src/common.h tar-1.26/src/common.h
---- tar-1.26.orig//src/common.h 2011-02-11 06:56:13.000000000 -0500
-+++ tar-1.26/src/common.h 2011-09-07 06:13:38.000000000 -0400
-@@ -253,6 +253,15 @@
+diff --git a/src/Makefile.am b/src/Makefile.am
+index de310f4..27c28be 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -20,7 +20,7 @@
+
+ bin_PROGRAMS = tar
+
+-noinst_HEADERS = arith.h common.h tar.h
++noinst_HEADERS = arith.h common.h tar.h xattrs.h
+ tar_SOURCES = \
+ buffer.c\
+ checkpoint.c\
+@@ -42,10 +42,11 @@ tar_SOURCES = \
+ unlink.c\
+ update.c\
+ utf8.c\
+- warning.c
++ warning.c\
++ xattrs.c
+
+ INCLUDES = -I$(top_srcdir)/gnu -I../ -I../gnu -I$(top_srcdir)/lib -I../lib
+
+ LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV)
+
+-tar_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)
++tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)
+diff --git a/src/common.h b/src/common.h
+index 0b9bd7a..e4ee345 100644
+--- a/src/common.h
++++ b/src/common.h
+@@ -253,6 +253,9 @@ GLOBAL int same_owner_option;
/* If positive, preserve permissions when extracting. */
GLOBAL int same_permissions_option;
-+/* If positive, save the SELinux context. */
-+GLOBAL int selinux_context_option;
-+
-+/* If positive, save the ACLs. */
-+GLOBAL int acls_option;
-+
+/* If positive, save the user and root xattrs. */
+GLOBAL int xattrs_option;
+
/* When set, strip the given number of file name components from the file name
before extracting */
GLOBAL size_t strip_name_components;
-@@ -707,6 +716,9 @@
+@@ -707,6 +710,9 @@ extern char *output_start;
void update_archive (void);
@@ -210,7 +130,7 @@ diff -Naur tar-1.26.orig//src/common.h tar-1.26/src/common.h
/* Module xheader.c. */
void xheader_decode (struct tar_stat_info *stat);
-@@ -727,6 +739,12 @@
+@@ -727,6 +733,12 @@ bool xheader_string_end (struct xheader *xhdr, char const *keyword);
bool xheader_keyword_deleted_p (const char *kw);
char *xheader_format_name (struct tar_stat_info *st, const char *fmt,
size_t n);
@@ -223,32 +143,16 @@ diff -Naur tar-1.26.orig//src/common.h tar-1.26/src/common.h
/* Module system.c */
-diff -Naur tar-1.26.orig//src/create.c tar-1.26/src/create.c
---- tar-1.26.orig//src/create.c 2011-03-12 04:09:33.000000000 -0500
-+++ tar-1.26/src/create.c 2011-09-07 06:13:38.000000000 -0400
-@@ -24,6 +24,7 @@
- #include <quotearg.h>
-
- #include "common.h"
-+
- #include <hash.h>
-
- /* Error number to use when an impostor is discovered.
-@@ -936,6 +937,30 @@
+diff --git a/src/create.c b/src/create.c
+index 43b5a4c..7ed5d10 100644
+--- a/src/create.c
++++ b/src/create.c
+@@ -936,6 +936,21 @@ start_header (struct tar_stat_info *st)
GNAME_TO_CHARS (st->gname, header->header.gname);
}
+ if (archive_format == POSIX_FORMAT)
+ {
-+ if (acls_option > 0)
-+ {
-+ if (st->acls_a_ptr)
-+ xheader_store ("SCHILY.acl.access", st, NULL);
-+ if (st->acls_d_ptr)
-+ xheader_store ("SCHILY.acl.default", st, NULL);
-+ }
-+ if ((selinux_context_option > 0) && st->cntx_name)
-+ xheader_store ("RHT.security.selinux", st, NULL);
+ if (xattrs_option > 0)
+ {
+ size_t scan_xattr = 0;
@@ -265,129 +169,88 @@ diff -Naur tar-1.26.orig//src/create.c tar-1.26/src/create.c
return header;
}
-@@ -1711,6 +1736,10 @@
+@@ -1711,6 +1726,11 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
bool ok;
struct stat final_stat;
-+ xattrs_acls_get(st, p, fd, !is_dir);
-+ xattrs_selinux_get(st, p, fd);
-+ xattrs_xattrs_get(st, p, fd);
++ if (fd == 0)
++ xattrs_xattrs_get(st, p, -1);
++ else
++ xattrs_xattrs_get(st, p, fd);
+
if (is_dir)
{
const char *tag_file_name;
-@@ -1829,6 +1858,9 @@
+@@ -1829,6 +1849,8 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size)
write_long_link (st);
-+ xattrs_selinux_get(st, p, -1);
+ xattrs_xattrs_get(st, p, -1);
+
block_ordinal = current_block_ordinal ();
st->stat.st_size = 0; /* force 0 size on symlink */
header = start_header (st);
-@@ -1847,11 +1879,23 @@
+@@ -1847,11 +1869,20 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
}
#endif
else if (S_ISCHR (st->stat.st_mode))
- type = CHRTYPE;
+ {
+ type = CHRTYPE;
-+ xattrs_selinux_get(st, p, -1);
+ xattrs_xattrs_get(st, p, -1);
+ }
else if (S_ISBLK (st->stat.st_mode))
- type = BLKTYPE;
+ {
+ type = BLKTYPE;
-+ xattrs_selinux_get(st, p, -1);
+ xattrs_xattrs_get(st, p, -1);
+ }
else if (S_ISFIFO (st->stat.st_mode))
- type = FIFOTYPE;
+ {
+ type = FIFOTYPE;
-+ xattrs_selinux_get(st, p, -1);
+ xattrs_xattrs_get(st, p, -1);
+ }
else if (S_ISSOCK (st->stat.st_mode))
{
WARNOPT (WARN_FILE_IGNORED,
-diff -Naur tar-1.26.orig//src/extract.c tar-1.26/src/extract.c
---- tar-1.26.orig//src/extract.c 2010-11-27 05:33:22.000000000 -0500
-+++ tar-1.26/src/extract.c 2011-09-07 06:13:38.000000000 -0400
-@@ -97,6 +97,14 @@
+diff --git a/src/extract.c b/src/extract.c
+index aaea56e..5c0a9c9 100644
+--- a/src/extract.c
++++ b/src/extract.c
+@@ -97,6 +97,9 @@ struct delayed_set_stat
/* Directory that the name is relative to. */
int change_dir;
+ /* extended attributes*/
-+ char *cntx_name;
-+ char *acls_a_ptr;
-+ size_t acls_a_len;
-+ char *acls_d_ptr;
-+ size_t acls_d_len;
+ size_t xattr_map_size; /* Size of the xattr map */
+ struct xattr_array *xattr_map;
/* Length and contents of name. */
size_t file_name_len;
char file_name[1];
-@@ -134,6 +142,18 @@
+@@ -134,6 +137,9 @@ struct delayed_link
hard-linked together. */
struct string_list *sources;
-+ /* SELinux context */
-+ char *cntx_name;
-+
-+ /* ACLs */
-+ char *acls_a_ptr;
-+ size_t acls_a_len;
-+ char *acls_d_ptr;
-+ size_t acls_d_len;
-+
+ size_t xattr_map_size; /* Size of the xattr map */
+ struct xattr_array *xattr_map;
+
/* The desired target of the desired link. */
char target[1];
};
-@@ -335,6 +355,10 @@
+@@ -335,6 +341,8 @@ set_stat (char const *file_name,
utime_error (file_name);
}
-+ xattrs_acls_set(st, file_name, typeflag);
-+ xattrs_selinux_set(st, file_name, typeflag);
+ xattrs_xattrs_set(st, file_name, typeflag);
+
if (0 < same_owner_option && ! interdir)
{
/* Some systems allow non-root users to give files away. Once this
-@@ -431,6 +455,36 @@
+@@ -431,6 +439,13 @@ delay_set_stat (char const *file_name, struct tar_stat_info const *st,
data->atflag = atflag;
data->after_links = 0;
data->change_dir = chdir_current;
-+ data->cntx_name = NULL;
-+ if (st)
-+ assign_string (&data->cntx_name, st->cntx_name);
-+ if (st && st->acls_a_ptr)
-+ {
-+ data->acls_a_ptr = xmemdup(st->acls_a_ptr, st->acls_a_len + 1);
-+ data->acls_a_len = st->acls_a_len;
-+ }
-+ else
-+ {
-+ data->acls_a_ptr = NULL;
-+ data->acls_a_len = 0;
-+ }
-+ if (st && st->acls_d_ptr)
-+ {
-+ data->acls_d_ptr = xmemdup(st->acls_d_ptr, st->acls_d_len + 1);
-+ data->acls_d_len = st->acls_d_len;
-+ }
-+ else
-+ {
-+ data->acls_d_ptr = NULL;
-+ data->acls_d_len = 0;
-+ }
+ if (st)
+ xheader_xattr_copy (st, &data->xattr_map, &data->xattr_map_size);
+ else
@@ -398,7 +261,7 @@ diff -Naur tar-1.26.orig//src/extract.c tar-1.26/src/extract.c
strcpy (data->file_name, file_name);
delayed_set_stat_head = data;
if (must_be_dot_or_slash (file_name))
-@@ -673,6 +727,31 @@
+@@ -673,6 +688,31 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
return RECOVER_NO;
}
@@ -430,15 +293,10 @@ diff -Naur tar-1.26.orig//src/extract.c tar-1.26/src/extract.c
/* Fix the statuses of all directories whose statuses need fixing, and
which are not ancestors of FILE_NAME. If AFTER_LINKS is
nonzero, do this for all such directories; otherwise, stop at the
-@@ -733,12 +812,23 @@
+@@ -733,12 +773,15 @@ apply_nonancestor_delayed_set_stat (char const *file_name, bool after_links)
sb.stat.st_gid = data->gid;
sb.atime = data->atime;
sb.mtime = data->mtime;
-+ sb.cntx_name = data->cntx_name;
-+ sb.acls_a_ptr = data->acls_a_ptr;
-+ sb.acls_a_len = data->acls_a_len;
-+ sb.acls_d_ptr = data->acls_d_ptr;
-+ sb.acls_d_len = data->acls_d_len;
+ sb.xattr_map = data->xattr_map;
+ sb.xattr_map_size = data->xattr_map_size;
set_stat (data->file_name, &sb,
@@ -448,13 +306,10 @@ diff -Naur tar-1.26.orig//src/extract.c tar-1.26/src/extract.c
delayed_set_stat_head = data->next;
+ xheader_xattr_free (data->xattr_map, data->xattr_map_size);
-+ free (data->cntx_name);
-+ free (data->acls_a_ptr);
-+ free (data->acls_d_ptr);
free (data);
}
}
-@@ -854,6 +944,7 @@
+@@ -854,6 +897,7 @@ extract_dir (char *file_name, int typeflag)
static int
open_output_file (char const *file_name, int typeflag, mode_t mode,
@@ -462,7 +317,7 @@ diff -Naur tar-1.26.orig//src/extract.c tar-1.26/src/extract.c
mode_t *current_mode, mode_t *current_mode_mask)
{
int fd;
-@@ -864,6 +955,10 @@
+@@ -864,6 +908,10 @@ open_output_file (char const *file_name, int typeflag, mode_t mode,
? O_TRUNC | (dereference_option ? 0 : O_NOFOLLOW)
: O_EXCL));
@@ -473,7 +328,7 @@ diff -Naur tar-1.26.orig//src/extract.c tar-1.26/src/extract.c
if (typeflag == CONTTYPE)
{
static int conttype_diagnosed;
-@@ -934,6 +1029,7 @@
+@@ -934,6 +982,7 @@ extract_file (char *file_name, int typeflag)
bool interdir_made = false;
mode_t mode = (current_stat_info.stat.st_mode & MODE_RWX
& ~ (0 < same_owner_option ? S_IRWXG | S_IRWXO : 0));
@@ -481,7 +336,7 @@ diff -Naur tar-1.26.orig//src/extract.c tar-1.26/src/extract.c
mode_t current_mode = 0;
mode_t current_mode_mask = 0;
-@@ -950,7 +1046,17 @@
+@@ -950,7 +999,17 @@ extract_file (char *file_name, int typeflag)
}
else
{
@@ -499,113 +354,50 @@ diff -Naur tar-1.26.orig//src/extract.c tar-1.26/src/extract.c
¤t_mode, ¤t_mode_mask))
< 0)
{
-@@ -1091,6 +1197,13 @@
+@@ -1091,6 +1150,7 @@ create_placeholder_file (char *file_name, bool is_symlink, bool *interdir_made)
+ strlen (file_name) + 1);
p->sources->next = 0;
strcpy (p->sources->string, file_name);
-+ p->cntx_name = NULL;
-+ assign_string (&p->cntx_name, current_stat_info.cntx_name);
-+ p->acls_a_ptr = NULL;
-+ p->acls_a_len = 0;
-+ p->acls_d_ptr = NULL;
-+ p->acls_d_len = 0;
+ xheader_xattr_copy (¤t_stat_info, &p->xattr_map, &p->xattr_map_size);
strcpy (p->target, current_stat_info.link_name);
h = delayed_set_stat_head;
-@@ -1525,6 +1638,13 @@
+@@ -1525,6 +1585,8 @@ apply_delayed_links (void)
st1.stat.st_gid = ds->gid;
st1.atime = ds->atime;
st1.mtime = ds->mtime;
-+ st1.cntx_name = ds->cntx_name;
-+ st1.acls_a_ptr = ds->acls_a_ptr;
-+ st1.acls_a_len = ds->acls_a_len;
-+ st1.acls_d_ptr = ds->acls_d_ptr;
-+ st1.acls_d_len = ds->acls_d_len;
+ st1.xattr_map = ds->xattr_map;
+ st1.xattr_map_size = ds->xattr_map_size;
set_stat (source, &st1, -1, 0, 0, SYMTYPE,
false, AT_SYMLINK_NOFOLLOW);
valid_source = source;
-@@ -1539,6 +1659,9 @@
+@@ -1539,6 +1601,8 @@ apply_delayed_links (void)
sources = next;
}
+ xheader_xattr_free (ds->xattr_map, ds->xattr_map_size);
-+ free (ds->cntx_name);
+
{
struct delayed_link *next = ds->next;
free (ds);
-diff -Naur tar-1.26.orig//src/list.c tar-1.26/src/list.c
---- tar-1.26.orig//src/list.c 2011-02-16 17:12:16.000000000 -0500
-+++ tar-1.26/src/list.c 2011-09-07 06:13:38.000000000 -0400
-@@ -604,6 +604,13 @@
+diff --git a/src/list.c b/src/list.c
+index cf2de09..6f52579 100644
+--- a/src/list.c
++++ b/src/list.c
+@@ -604,6 +604,8 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
assign_string (&stat_info->gname,
header->header.gname[0] ? header->header.gname : NULL);
-+ stat_info->acls_a_ptr = NULL;
-+ stat_info->acls_a_len = 0;
-+ stat_info->acls_d_ptr = NULL;
-+ stat_info->acls_d_len = 0;
-+ stat_info->cntx_name = NULL;
+ xheader_xattr_init(stat_info);
+
if (format == OLDGNU_FORMAT && incremental_option)
{
stat_info->atime.tv_sec = TIME_FROM_HEADER (header->oldgnu_header.atime);
-diff -Naur tar-1.26.orig//src/Makefile.am tar-1.26/src/Makefile.am
---- tar-1.26.orig//src/Makefile.am 2010-10-24 14:07:54.000000000 -0400
-+++ tar-1.26/src/Makefile.am 2011-09-07 06:13:38.000000000 -0400
-@@ -20,7 +20,7 @@
-
- bin_PROGRAMS = tar
-
--noinst_HEADERS = arith.h common.h tar.h
-+noinst_HEADERS = arith.h common.h tar.h xattrs.h
- tar_SOURCES = \
- buffer.c\
- checkpoint.c\
-@@ -42,10 +42,11 @@
- unlink.c\
- update.c\
- utf8.c\
-- warning.c
-+ warning.c\
-+ xattrs.c
-
- INCLUDES = -I$(top_srcdir)/gnu -I../ -I../gnu -I$(top_srcdir)/lib -I../lib
-
- LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV)
-
--tar_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)
-+tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)
-diff -Naur tar-1.26.orig//src/tar.c tar-1.26/src/tar.c
---- tar-1.26.orig//src/tar.c 2010-10-24 14:07:55.000000000 -0400
-+++ tar-1.26/src/tar.c 2011-09-07 06:13:38.000000000 -0400
-@@ -255,7 +255,8 @@
-
- enum
- {
-- ANCHORED_OPTION = CHAR_MAX + 1,
-+ ACLS_OPTION = CHAR_MAX + 1,
-+ ANCHORED_OPTION,
- ATIME_PRESERVE_OPTION,
- BACKUP_OPTION,
- CHECK_DEVICE_OPTION,
-@@ -288,6 +289,7 @@
- MODE_OPTION,
- MTIME_OPTION,
- NEWER_MTIME_OPTION,
-+ NO_ACLS_OPTION,
- NO_ANCHORED_OPTION,
- NO_AUTO_COMPRESS_OPTION,
- NO_CHECK_DEVICE_OPTION,
-@@ -301,9 +303,11 @@
- NO_SAME_OWNER_OPTION,
- NO_SAME_PERMISSIONS_OPTION,
- NO_SEEK_OPTION,
-+ NO_SELINUX_CONTEXT_OPTION,
+diff --git a/src/tar.c b/src/tar.c
+index 928cfdd..75510d8 100644
+--- a/src/tar.c
++++ b/src/tar.c
+@@ -304,6 +304,7 @@ enum
NO_UNQUOTE_OPTION,
NO_WILDCARDS_MATCH_SLASH_OPTION,
NO_WILDCARDS_OPTION,
@@ -613,15 +405,7 @@ diff -Naur tar-1.26.orig//src/tar.c tar-1.26/src/tar.c
NULL_OPTION,
NUMERIC_OWNER_OPTION,
OCCURRENCE_OPTION,
-@@ -325,6 +329,7 @@
- RMT_COMMAND_OPTION,
- RSH_COMMAND_OPTION,
- SAME_OWNER_OPTION,
-+ SELINUX_CONTEXT_OPTION,
- SHOW_DEFAULTS_OPTION,
- SHOW_OMITTED_DIRS_OPTION,
- SHOW_TRANSFORMED_NAMES_OPTION,
-@@ -340,7 +345,8 @@
+@@ -340,7 +341,8 @@ enum
VOLNO_FILE_OPTION,
WARNING_OPTION,
WILDCARDS_MATCH_SLASH_OPTION,
@@ -631,25 +415,10 @@ diff -Naur tar-1.26.orig//src/tar.c tar-1.26/src/tar.c
};
const char *argp_program_version = "tar (" PACKAGE_NAME ") " VERSION;
-@@ -486,6 +492,10 @@
- {NULL, 0, NULL, 0,
- N_("Handling of file attributes:"), GRID },
-
-+ {"acls", ACLS_OPTION, 0, 0,
-+ N_("Save the ACLs to the archive"), GRID+1 },
-+ {"no-acls", NO_ACLS_OPTION, 0, 0,
-+ N_("Don't extract the ACLs from the archive"), GRID+1 },
- {"owner", OWNER_OPTION, N_("NAME"), 0,
- N_("force NAME as owner for added files"), GRID+1 },
- {"group", GROUP_OPTION, N_("NAME"), 0,
-@@ -516,6 +526,14 @@
+@@ -516,6 +518,10 @@ static struct argp_option options[] = {
{"preserve-order", 's', 0, 0,
N_("sort names to extract to match archive"), GRID+1 },
{"same-order", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
-+ {"selinux", SELINUX_CONTEXT_OPTION, 0, 0,
-+ N_("Save the SELinux context to the archive"), GRID+1 },
-+ {"no-selinux", NO_SELINUX_CONTEXT_OPTION, 0, 0,
-+ N_("Don't extract the SELinux context from the archive"), GRID+1 },
+ {"xattrs", XATTR_OPTION, 0, 0,
+ N_("Save the user/root xattrs to the archive"), GRID+1 },
+ {"no-xattrs", NO_XATTR_OPTION, 0, 0,
@@ -657,64 +426,28 @@ diff -Naur tar-1.26.orig//src/tar.c tar-1.26/src/tar.c
{"preserve", PRESERVE_OPTION, 0, 0,
N_("same as both -p and -s"), GRID+1 },
{"delay-directory-restore", DELAY_DIRECTORY_RESTORE_OPTION, 0, 0,
-@@ -2079,6 +2097,37 @@
+@@ -2079,6 +2085,15 @@ parse_opt (int key, char *arg, struct argp_state *state)
same_permissions_option = -1;
break;
-+ case ACLS_OPTION:
-+ set_archive_format ("posix");
-+ acls_option = 1;
-+ break;
-+
-+ case NO_ACLS_OPTION:
-+ acls_option = -1;
-+ break;
-+
-+ case SELINUX_CONTEXT_OPTION:
-+ set_archive_format ("posix");
-+ selinux_context_option = 1;
-+ break;
-+
-+ case NO_SELINUX_CONTEXT_OPTION:
-+ selinux_context_option = -1;
-+ break;
-+
+ case XATTR_OPTION:
+ set_archive_format ("posix");
-+ if (!acls_option) acls_option = 1;
-+ if (!selinux_context_option) selinux_context_option = 1;
+ xattrs_option = 1;
+ break;
+
+ case NO_XATTR_OPTION:
-+ if (!acls_option) acls_option = -1;
-+ if (!selinux_context_option) selinux_context_option = -1;
+ xattrs_option = -1;
+ break;
+
case RECURSION_OPTION:
recursion_option = FNM_LEADING_DIR;
break;
-@@ -2461,6 +2510,29 @@
+@@ -2461,6 +2476,15 @@ decode_options (int argc, char **argv)
|| subcommand_option != LIST_SUBCOMMAND))
USAGE_ERROR ((0, 0, _("--pax-option can be used only on POSIX archives")));
+ /* star create's non-POSIX typed archives with xattr support, so allow the
+ extra headers */
-+ if ((acls_option > 0)
-+ && archive_format != POSIX_FORMAT
-+ && (subcommand_option != EXTRACT_SUBCOMMAND
-+ || subcommand_option != DIFF_SUBCOMMAND
-+ || subcommand_option != LIST_SUBCOMMAND))
-+ USAGE_ERROR ((0, 0, _("--acls can be used only on POSIX archives")));
-+
-+ if ((selinux_context_option > 0)
-+ && archive_format != POSIX_FORMAT
-+ && (subcommand_option != EXTRACT_SUBCOMMAND
-+ || subcommand_option != DIFF_SUBCOMMAND
-+ || subcommand_option != LIST_SUBCOMMAND))
-+ USAGE_ERROR ((0, 0, _("--selinux can be used only on POSIX archives")));
-+
+ if ((xattrs_option > 0)
+ && archive_format != POSIX_FORMAT
+ && (subcommand_option != EXTRACT_SUBCOMMAND
@@ -725,7 +458,7 @@ diff -Naur tar-1.26.orig//src/tar.c tar-1.26/src/tar.c
/* If ready to unlink hierarchies, so we are for simpler files. */
if (recursive_unlink_option)
old_files_option = UNLINK_FIRST_OLD_FILES;
-@@ -2713,11 +2785,15 @@
+@@ -2713,6 +2737,7 @@ void
tar_stat_destroy (struct tar_stat_info *st)
{
tar_stat_close (st);
@@ -733,18 +466,11 @@ diff -Naur tar-1.26.orig//src/tar.c tar-1.26/src/tar.c
free (st->orig_file_name);
free (st->file_name);
free (st->link_name);
- free (st->uname);
- free (st->gname);
-+ free (st->cntx_name);
-+ free (st->acls_a_ptr);
-+ free (st->acls_d_ptr);
- free (st->sparse_map);
- free (st->dumpdir);
- xheader_destroy (&st->xhdr);
-diff -Naur tar-1.26.orig//src/tar.h tar-1.26/src/tar.h
---- tar-1.26.orig//src/tar.h 2010-10-24 14:07:46.000000000 -0400
-+++ tar-1.26/src/tar.h 2011-09-07 06:13:38.000000000 -0400
-@@ -276,6 +276,14 @@
+diff --git a/src/tar.h b/src/tar.h
+index ce9850c..955b18e 100644
+--- a/src/tar.h
++++ b/src/tar.h
+@@ -276,6 +276,14 @@ struct xheader
uintmax_t string_length;
};
@@ -759,23 +485,15 @@ diff -Naur tar-1.26.orig//src/tar.h tar-1.26/src/tar.h
struct tar_stat_info
{
char *orig_file_name; /* name of file read from the archive header */
-@@ -287,6 +295,15 @@
+@@ -287,6 +295,7 @@ struct tar_stat_info
char *uname; /* user name of owner */
char *gname; /* group name of owner */
+
-+ char *cntx_name; /* SELinux context for the current archive entry. */
-+
-+ char *acls_a_ptr; /* Access ACLs for the current archive entry. */
-+ size_t acls_a_len; /* Access ACLs for the current archive entry. */
-+
-+ char *acls_d_ptr; /* Default ACLs for the current archive entry. */
-+ size_t acls_d_len; /* Default ACLs for the current archive entry. */
-+
struct stat stat; /* regular filesystem stat */
/* STAT doesn't always have access, data modification, and status
-@@ -309,6 +326,9 @@
+@@ -309,6 +318,9 @@ struct tar_stat_info
size_t sparse_map_size; /* Size of the sparse map */
struct sp_array *sparse_map;
@@ -785,10 +503,12 @@ diff -Naur tar-1.26.orig//src/tar.h tar-1.26/src/tar.h
/* Extended headers */
struct xheader xhdr;
-diff -Naur tar-1.26.orig//src/xattrs.c tar-1.26/src/xattrs.c
---- tar-1.26.orig//src/xattrs.c 1969-12-31 19:00:00.000000000 -0500
-+++ tar-1.26/src/xattrs.c 2011-09-07 06:13:38.000000000 -0400
-@@ -0,0 +1,489 @@
+diff --git a/src/xattrs.c b/src/xattrs.c
+new file mode 100644
+index 0000000..6a9950e
+--- /dev/null
++++ b/src/xattrs.c
+@@ -0,0 +1,181 @@
+/* Create a tar archive.
+
+ Copyright (C) 2006 Free Software Foundation, Inc.
@@ -816,174 +536,14 @@ diff -Naur tar-1.26.orig//src/xattrs.c tar-1.26/src/xattrs.c
+#include "common.h"
+
+
-+#ifndef HAVE_SELINUX_SELINUX_H
-+# undef HAVE_LIBSELINUX
-+#endif
-+
+#ifndef HAVE_ATTR_XATTR_H
+# undef HAVE_XATTRS
+#endif
+
-+#ifndef HAVE_SYS_ACL_H
-+# undef HAVE_LIBACL
-+#endif
-+
-+#ifdef HAVE_SELINUX_SELINUX_H
-+# include <selinux/selinux.h>
-+#endif
-+
+#ifdef HAVE_ATTR_XATTR_H
+# include <attr/xattr.h>
+#endif
+
-+#ifdef HAVE_SYS_ACL_H
-+# include <sys/acl.h>
-+#endif
-+
-+
-+#if 0 /* unused by xattr's atm. */
-+static void xattrs__fd_get(struct tar_stat_info *st,
-+ char const *file_name, int fd, const char *attr,
-+ char **ret_ptr, size_t *ret_len)
-+{
-+#ifdef HAVE_XATTRS
-+ static ssize_t asz = 1024;
-+ ssize_t ret = 0;
-+ static char *val = NULL;
-+
-+ if (!val) val = xmalloc (asz);
-+
-+ while (((ret = fgetxattr (fd, attr, val, asz)) == -1) &&
-+ (errno == ERANGE))
-+ {
-+ asz <<= 1;
-+ val = xrealloc (val, asz);
-+ }
-+
-+ if (ret != -1)
-+ {
-+ *ret_ptr = xmemdup (val, ret + 1);
-+ *ret_len = ret;
-+ }
-+ else if (errno != ENOATTR)
-+ call_arg_warn ("fgetxattr", file_name);
-+#endif
-+}
-+#endif
-+
-+static void xattrs__acls_get_a(struct tar_stat_info *st,
-+ char const *file_name, int fd,
-+ char **ret_ptr, size_t *ret_len)
-+{ /* "system.posix_acl_access" */
-+#ifdef HAVE_LIBACL
-+ char *val = NULL;
-+ ssize_t len;
-+ acl_t acl;
-+
-+ if (fd != -1)
-+ {
-+ if ((acl = acl_get_fd (fd)) == (acl_t)NULL)
-+ {
-+ if (errno != ENOTSUP)
-+ call_arg_warn ("acl_get_fd", file_name);
-+ return;
-+ }
-+ }
-+ else if ((acl = acl_get_file (file_name, ACL_TYPE_ACCESS)) == (acl_t)NULL)
-+ {
-+ if (errno != ENOTSUP)
-+ call_arg_warn ("acl_get_file", file_name);
-+ return;
-+ }
-+
-+
-+ val = acl_to_text(acl, &len);
-+ acl_free (acl);
-+
-+ if (val == NULL)
-+ {
-+ call_arg_warn ("acl_to_text", file_name);
-+ return;
-+ }
-+
-+ *ret_ptr = xstrdup (val);
-+ *ret_len = len;
-+
-+ acl_free (val);
-+#endif
-+}
-+
-+static void xattrs__acls_get_d(struct tar_stat_info *st,
-+ char const *file_name,
-+ char **ret_ptr, size_t *ret_len)
-+{ /* "system.posix_acl_default" */
-+#ifdef HAVE_LIBACL
-+ char *val = NULL;
-+ ssize_t len;
-+ acl_t acl;
-+
-+ if ((acl = acl_get_file (file_name, ACL_TYPE_DEFAULT)) == (acl_t)NULL)
-+ {
-+ if (errno != ENOTSUP)
-+ call_arg_warn ("acl_get_file", file_name);
-+ return;
-+ }
-+
-+ val = acl_to_text(acl, &len);
-+ acl_free (acl);
-+
-+ if (val == NULL)
-+ {
-+ call_arg_warn ("acl_to_text", file_name);
-+ return;
-+ }
-+
-+ *ret_ptr = xstrdup (val);
-+ *ret_len = len;
-+
-+ acl_free (val);
-+#endif
-+}
-+
-+void xattrs_acls_get(struct tar_stat_info *st, char const *file_name, int fd,
-+ int xisfile)
-+{
-+ if (acls_option > 0)
-+ {
-+#ifndef HAVE_LIBACL
-+ static int done = 0;
-+ if (!done)
-+ WARN ((0, 0, _("ACL support requested, but not available")));
-+ done = 1;
-+#endif
-+ xattrs__acls_get_a (st, file_name, fd,
-+ &st->acls_a_ptr, &st->acls_a_len);
-+ if (!xisfile)
-+ xattrs__acls_get_d (st, file_name,
-+ &st->acls_d_ptr, &st->acls_d_len);
-+ }
-+}
-+
-+void xattrs_selinux_get(struct tar_stat_info *st, char const *file_name, int fd)
-+{
-+ if (selinux_context_option > 0)
-+ {
-+#ifndef HAVE_LIBSELINUX
-+ static int done = 0;
-+ if (!done)
-+ WARN ((0, 0, _("SELinux support requested, but not available")));
-+ done = 1;
-+#else
-+ if (fd == -1)
-+ {
-+ if ((lgetfilecon (file_name, &st->cntx_name) == -1) && (errno != ENOTSUP) && (errno != ENODATA))
-+ call_arg_warn ("lgetfilecon", file_name);
-+ }
-+ else if ((fgetfilecon (fd, &st->cntx_name) == -1) && (errno != ENOTSUP) && (errno != ENODATA))
-+ call_arg_warn ("fgetfilecon", file_name);
-+#endif
-+ }
-+}
+
+void xattrs_xattrs_get(struct tar_stat_info *st, char const *file_name, int fd)
+{
@@ -1079,32 +639,6 @@ diff -Naur tar-1.26.orig//src/xattrs.c tar-1.26/src/xattrs.c
+#endif
+}
+
-+/* convert unix permissions into an ACL ... needed due to "default" ACLs */
-+#ifdef HAVE_LIBACL
-+static acl_t perms2acl(int perms)
-+{
-+ char val[] = "user::---,group::---,other::---";
-+ /* 0123456789 123456789 123456789 123456789 */
-+
-+ /* user */
-+ if (perms & 0400) val[ 6] = 'r';
-+ if (perms & 0200) val[ 7] = 'w';
-+ if (perms & 0100) val[ 8] = 'x';
-+
-+ /* group */
-+ if (perms & 0040) val[17] = 'r';
-+ if (perms & 0020) val[18] = 'w';
-+ if (perms & 0010) val[19] = 'x';
-+
-+ /* other */
-+ if (perms & 0004) val[28] = 'r';
-+ if (perms & 0002) val[29] = 'w';
-+ if (perms & 0001) val[30] = 'x';
-+
-+ return (acl_from_text (val));
-+}
-+#endif
-+
+static char *skip_to_ext_fields(char *ptr)
+{
+ ptr += strcspn(ptr, ":,\n"); /* skip tag name. Ie. user/group/default/mask */
@@ -1127,122 +661,6 @@ diff -Naur tar-1.26.orig//src/xattrs.c tar-1.26/src/xattrs.c
+ return (ptr);
+}
+
-+/* The POSIX draft allows extra fields after the three main ones. Star
-+ uses this to add a fourth field for user/group which is the numeric ID.
-+ We just skip all extra fields atm. */
-+static const char *fixup_extra_acl_fields(const char *ptr)
-+{
-+ char *src = (char *)ptr;
-+ char *dst = (char *)ptr;
-+
-+ while (*src)
-+ {
-+ const char *old = src;
-+ size_t len = 0;
-+
-+ src = skip_to_ext_fields(src);
-+ len = src - old;
-+ if (old != dst) memmove(dst, old, len);
-+ dst += len;
-+
-+ if (*src == ':') /* We have extra fields, skip them all */
-+ src += strcspn(src, "\n,");
-+
-+ if ((*src == '\n') || (*src == ','))
-+ *dst++ = *src++; /* also done when dst == src, but that's ok */
-+ }
-+ if (src != dst)
-+ *dst = 0;
-+
-+ return ptr;
-+}
-+
-+static void xattrs__acls_set(struct tar_stat_info const *st,
-+ char const *file_name, int type,
-+ const char *ptr, size_t len)
-+{ /* "system.posix_acl_access" */
-+#ifdef HAVE_LIBACL
-+ acl_t acl;
-+
-+ if (ptr)
-+ {
-+ /* assert (strlen (ptr) == len); */
-+ ptr = fixup_extra_acl_fields(ptr);
-+
-+ acl = acl_from_text (ptr);
-+ acls_option = 1;
-+ }
-+ else if (acls_option > 0)
-+ acl = perms2acl (st->stat.st_mode);
-+ else
-+ return; /* don't call acl functions unless we first hit an ACL, or
-+ --acls was passed explicitly */
-+
-+ if (acl == (acl_t)NULL)
-+ {
-+ call_arg_warn ("acl_from_text", file_name);
-+ return;
-+ }
-+
-+ if (acl_set_file (file_name, type, acl) == -1)
-+ {
-+ if (errno != ENOTSUP)
-+ call_arg_warn ("acl_set_file", file_name);
-+ }
-+ acl_free (acl);
-+#endif
-+}
-+
-+void xattrs_acls_set(struct tar_stat_info const *st,
-+ char const *file_name, char typeflag)
-+{
-+ if ((acls_option >= 0) && (typeflag != SYMTYPE))
-+ {
-+#ifndef HAVE_LIBACL
-+ static int done = 0;
-+ if (!done)
-+ WARN ((0, 0, _("ACL support requested, but not available")));
-+ done = 1;
-+#else
-+ xattrs__acls_set (st, file_name, ACL_TYPE_ACCESS,
-+ st->acls_a_ptr, st->acls_a_len);
-+ if ((typeflag == DIRTYPE) || (typeflag == GNUTYPE_DUMPDIR))
-+ xattrs__acls_set (st, file_name, ACL_TYPE_DEFAULT,
-+ st->acls_d_ptr, st->acls_d_len);
-+#endif
-+ }
-+}
-+
-+void xattrs_selinux_set(struct tar_stat_info const *st,
-+ char const *file_name, char typeflag)
-+{
-+ if ((selinux_context_option >= 0) && st->cntx_name)
-+ {
-+ const char *sysname = "setfilecon";
-+ int ret = -1;
-+
-+#ifndef HAVE_LIBSELINUX
-+ static int done = 0;
-+ if (!done)
-+ WARN ((0, 0, _("SELinux support requested, but not available")));
-+ done = 1;
-+#else
-+ if (typeflag != SYMTYPE)
-+ ret = setfilecon (file_name, st->cntx_name);
-+ else
-+ {
-+ sysname = "lsetfilecon";
-+ ret = lsetfilecon (file_name, st->cntx_name);
-+ }
-+
-+ if ((ret == -1) && (errno == EPERM))
-+ call_arg_warn(sysname, file_name);
-+ else if ((ret == -1) && (errno != EOPNOTSUPP))
-+ call_arg_error(sysname, file_name);
-+#endif
-+ }
-+}
-+
+void xattrs_xattrs_set(struct tar_stat_info const *st,
+ char const *file_name, char typeflag)
+{
@@ -1263,12 +681,6 @@ diff -Naur tar-1.26.orig//src/xattrs.c tar-1.26/src/xattrs.c
+ /* assert (!memcpy (keyword, "SCHILY.xattr.", strlen("SCHILY.xattr."))); */
+ keyword += strlen("SCHILY.xattr.");
+
-+ if (strncmp (keyword, "user.", strlen("user.")) &&
-+ strncmp (keyword, "lustre.", strlen("lustre.")) &&
-+ strncmp (keyword, "trusted.", strlen("trusted.")) &&
-+ strncmp (keyword, "security.NTACL", strlen("security.NTACL")))
-+ continue; /* don't try and set anything but normal xattrs */
-+
+ xattrs__fd_set (st, file_name, typeflag, keyword,
+ st->xattr_map[scan].xval_ptr,
+ st->xattr_map[scan].xval_len);
@@ -1278,28 +690,23 @@ diff -Naur tar-1.26.orig//src/xattrs.c tar-1.26/src/xattrs.c
+#endif
+ }
+}
-diff -Naur tar-1.26.orig//src/xattrs.h tar-1.26/src/xattrs.h
---- tar-1.26.orig//src/xattrs.h 1969-12-31 19:00:00.000000000 -0500
-+++ tar-1.26/src/xattrs.h 2011-09-07 06:13:38.000000000 -0400
-@@ -0,0 +1,14 @@
-+
-+extern void xattrs_acls_get(struct tar_stat_info *st,
-+ char const *file_name, int fd, int xisfile);
-+extern void xattrs_selinux_get(struct tar_stat_info *st,
-+ char const *file_name, int fd);
+diff --git a/src/xattrs.h b/src/xattrs.h
+new file mode 100644
+index 0000000..7ffdce1
+--- /dev/null
++++ b/src/xattrs.h
+@@ -0,0 +1,6 @@
++
+extern void xattrs_xattrs_get(struct tar_stat_info *st,
+ char const *file_name, int fd);
+
-+extern void xattrs_acls_set(struct tar_stat_info const *st,
-+ char const *file_name, char typeflag);
-+extern void xattrs_selinux_set(struct tar_stat_info const *st,
-+ char const *file_name, char typeflag);
+extern void xattrs_xattrs_set(struct tar_stat_info const *st,
+ char const *file_name, char typeflag);
-diff -Naur tar-1.26.orig//src/xheader.c tar-1.26/src/xheader.c
---- tar-1.26.orig//src/xheader.c 2010-11-27 06:18:49.000000000 -0500
-+++ tar-1.26/src/xheader.c 2011-09-07 06:13:38.000000000 -0400
-@@ -460,6 +460,74 @@
+diff --git a/src/xheader.c b/src/xheader.c
+index 2284e97..557b3e5 100644
+--- a/src/xheader.c
++++ b/src/xheader.c
+@@ -460,6 +460,74 @@ xheader_write_global (struct xheader *xhdr)
}
}
@@ -1374,7 +781,7 @@ diff -Naur tar-1.26.orig//src/xheader.c tar-1.26/src/xheader.c
\f
/* General Interface */
-@@ -473,6 +541,7 @@
+@@ -473,6 +541,7 @@ struct xhdr_tab
struct xheader *, void const *data);
void (*decoder) (struct tar_stat_info *, char const *, char const *, size_t);
int flags;
@@ -1382,7 +789,7 @@ diff -Naur tar-1.26.orig//src/xheader.c tar-1.26/src/xheader.c
};
/* This declaration must be extern, because ISO C99 section 6.9.2
-@@ -489,8 +558,17 @@
+@@ -489,8 +558,17 @@ locate_handler (char const *keyword)
struct xhdr_tab const *p;
for (p = xhdr_tab; p->keyword; p++)
@@ -1402,7 +809,7 @@ diff -Naur tar-1.26.orig//src/xheader.c tar-1.26/src/xheader.c
return NULL;
}
-@@ -500,7 +578,7 @@
+@@ -500,7 +578,7 @@ xheader_protected_pattern_p (const char *pattern)
struct xhdr_tab const *p;
for (p = xhdr_tab; p->keyword; p++)
@@ -1411,7 +818,7 @@ diff -Naur tar-1.26.orig//src/xheader.c tar-1.26/src/xheader.c
return true;
return false;
}
-@@ -511,7 +589,7 @@
+@@ -511,7 +589,7 @@ xheader_protected_keyword_p (const char *keyword)
struct xhdr_tab const *p;
for (p = xhdr_tab; p->keyword; p++)
@@ -1420,54 +827,10 @@ diff -Naur tar-1.26.orig//src/xheader.c tar-1.26/src/xheader.c
return true;
return false;
}
-@@ -1470,6 +1548,71 @@
+@@ -1470,6 +1548,27 @@ volume_filename_decoder (struct tar_stat_info *st,
}
static void
-+xattr_selinux_coder (struct tar_stat_info const *st, char const *keyword,
-+ struct xheader *xhdr, void const *data)
-+{
-+ code_string (st->cntx_name, keyword, xhdr);
-+}
-+
-+static void
-+xattr_selinux_decoder (struct tar_stat_info *st,
-+ char const *keyword, char const *arg, size_t size)
-+{
-+ decode_string (&st->cntx_name, arg);
-+}
-+
-+static void
-+xattr_acls_a_coder (struct tar_stat_info const *st , char const *keyword,
-+ struct xheader *xhdr, void const *data)
-+{
-+ xheader_print_n (xhdr, keyword, st->acls_a_ptr, st->acls_a_len);
-+}
-+
-+static void
-+xattr_acls_a_decoder (struct tar_stat_info *st,
-+ char const *keyword, char const *arg, size_t size)
-+{
-+ st->acls_a_ptr = xmemdup (arg, size + 1);
-+ st->acls_a_len = size;
-+}
-+
-+static void
-+xattr_acls_d_coder (struct tar_stat_info const *st , char const *keyword,
-+ struct xheader *xhdr, void const *data)
-+{
-+ xheader_print_n (xhdr, keyword, st->acls_d_ptr, st->acls_d_len);
-+}
-+
-+static void
-+xattr_acls_d_decoder (struct tar_stat_info *st,
-+ char const *keyword, char const *arg, size_t size)
-+{
-+ st->acls_d_ptr = xmemdup (arg, size + 1);
-+ st->acls_d_len = size;
-+}
-+
-+static void
+xattr_coder (struct tar_stat_info const *st , char const *keyword,
+ struct xheader *xhdr, void const *data)
+{
@@ -1492,7 +855,7 @@ diff -Naur tar-1.26.orig//src/xheader.c tar-1.26/src/xheader.c
sparse_major_coder (struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr, void const *data)
{
-@@ -1506,53 +1649,53 @@
+@@ -1506,53 +1605,53 @@ sparse_minor_decoder (struct tar_stat_info *st,
}
struct xhdr_tab const xhdr_tab[] = {
@@ -1569,7 +932,7 @@ diff -Naur tar-1.26.orig//src/xheader.c tar-1.26/src/xheader.c
/* These may be present in a first global header of the archive.
They provide the same functionality as GNUTYPE_MULTIVOL header.
-@@ -1561,11 +1704,41 @@
+@@ -1561,11 +1660,14 @@ struct xhdr_tab const xhdr_tab[] = {
GNU.volume.offset keeps the offset of the start of this volume,
otherwise kept in oldgnu_header.offset. */
{ "GNU.volume.filename", volume_label_coder, volume_filename_decoder,
@@ -1582,35 +945,8 @@ diff -Naur tar-1.26.orig//src/xheader.c tar-1.26/src/xheader.c
- XHDR_PROTECTED | XHDR_GLOBAL },
+ XHDR_PROTECTED | XHDR_GLOBAL, false },
+
-+ /* We get the SELinux value from filecon, so add a namespace for SELinux
-+ instead of storing it in SCHILY.xattr.* (which would be RAW). */
-+ { "RHT.security.selinux",
-+ xattr_selinux_coder, xattr_selinux_decoder, 0, false },
-+
-+ /* ACLs, use the star format... */
-+ { "SCHILY.acl.access",
-+ xattr_acls_a_coder, xattr_acls_a_decoder, 0, false },
-+
-+ { "SCHILY.acl.default",
-+ xattr_acls_d_coder, xattr_acls_d_decoder, 0, false },
-+
-+ /* FIXME: These are compat. for FC-6 ... we shipped a tar using the generic
-+ header names by accident. */
-+ { "SCHILY.xattr.security.selinux",
-+ xattr_selinux_coder, xattr_selinux_decoder, 0, false },
-+ { "SCHILY.xattr.system.posix_acl_access",
-+ xattr_acls_a_coder, xattr_acls_a_decoder, 0, false },
-+ { "SCHILY.xattr.system.posix_acl_default",
-+ xattr_acls_d_coder, xattr_acls_d_decoder, 0, false },
-+
+ /* xattrs use the star format. note we only save some variants... */
-+ { "SCHILY.xattr.user", xattr_coder, xattr_decoder, 0, true },
-+ { "SCHILY.xattr.trusted", xattr_coder, xattr_decoder, 0, true },
-+ { "SCHILY.xattr.lustre", xattr_coder, xattr_decoder, 0, true },
-+ { "SCHILY.xattr.security.NTACL", xattr_coder, xattr_decoder, 0, true },
-+
-+ /* ignore everything else in the xattr namespaces... */
-+ { "SCHILY.xattr", dummy_coder, dummy_decoder, 0, true },
++ { "SCHILY.xattr", xattr_coder, xattr_decoder, 0, true },
- { NULL, NULL, NULL, 0 }
+ { NULL, NULL, NULL, 0, false }
diff --git a/app-arch/tar/tar-1.26-r1.ebuild b/app-arch/tar/tar-1.26-r2.ebuild
similarity index 97%
rename from app-arch/tar/tar-1.26-r1.ebuild
rename to app-arch/tar/tar-1.26-r2.ebuild
index 8be654b..cc6033f 100644
--- a/app-arch/tar/tar-1.26-r1.ebuild
+++ b/app-arch/tar/tar-1.26-r2.ebuild
@@ -15,7 +15,7 @@ SRC_URI="http://ftp.gnu.org/gnu/tar/${P}.tar.bz2
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="nls static userland_GNU selinux"
+IUSE="nls static userland_GNU xattr"
RDEPEND=""
DEPEND="${RDEPEND}
@@ -45,7 +45,7 @@ src_configure() {
--bindir="${EPREFIX}"/bin \
--libexecdir="${EPREFIX}"/usr/sbin \
$(use_enable nls) \
- $(use_enable selinux)
+ $(use_enable xattr)
${myconf}
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] dev/blueness:master commit in: app-arch/tar/files/, app-arch/tar/
@ 2011-09-24 20:21 Anthony G. Basile
0 siblings, 0 replies; 4+ messages in thread
From: Anthony G. Basile @ 2011-09-24 20:21 UTC (permalink / raw
To: gentoo-commits
commit: d7da9c4fa8efd5d5d730e8e3ced15785cc868fb3
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 24 20:21:04 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Sep 24 20:21:04 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/blueness.git;a=commit;h=d7da9c4f
Added USE='acl caps selinux xattr' flags which --enable-xattr
(Portage version: 2.1.10.11/git/Linux x86_64, signed Manifest commit with key 0xD0455535)
---
app-arch/tar/ChangeLog | 7 +++++++
app-arch/tar/Manifest | 12 ++++++------
...-1.26-xattr.patch => tar-1.26-full-xattr.patch} | 0
.../tar/{tar-1.26-r2.ebuild => tar-1.26-r3.ebuild} | 8 +++++---
4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/app-arch/tar/ChangeLog b/app-arch/tar/ChangeLog
index 5d2729f..1106a6b 100644
--- a/app-arch/tar/ChangeLog
+++ b/app-arch/tar/ChangeLog
@@ -1,5 +1,12 @@
+*tar-1.26-r3 (24 Sep 2011)
+
+ 24 Sep 2011; Anthony G. Basile <blueness@gentoo.org> -tar-1.26-r2.ebuild,
+ +tar-1.26-r3.ebuild, +files/tar-1.26-full-xattr.patch,
+ -files/tar-1.26-xattr.patch:
+ Added USE="acl caps selinux xattr" flags which --enable-xattr
+
*tar-1.26-r2 (24 Sep 2011)
24 Sep 2011; Anthony G. Basile <blueness@gentoo.org> -tar-1.26-r1.ebuild,
diff --git a/app-arch/tar/Manifest b/app-arch/tar/Manifest
index 2ecc9c3..936e8f9 100644
--- a/app-arch/tar/Manifest
+++ b/app-arch/tar/Manifest
@@ -2,16 +2,16 @@
Hash: SHA256
AUX rmt 263 RMD160 c5d680ef166b8afda1e78cb5c7d1b47cdb6c99df SHA1 43b791b49aa06e151b90e8e91e3287af3259a62a SHA256 c0371cb0243a190b6bb43609c86dfb4cd637882d4ff3ff9651ca7ec8d6b59355
-AUX tar-1.26-xattr.patch 30674 RMD160 d24c88a738bee992c53c9fed469c93fff90ede2c SHA1 5fd7dcd43adb5812254d684e6ddafd113d1877f7 SHA256 c91bdb1c434fb71a1aa7df3d87466010a32a9f6293dba466c3a5401c2cc6a4db
+AUX tar-1.26-full-xattr.patch 30674 RMD160 d24c88a738bee992c53c9fed469c93fff90ede2c SHA1 5fd7dcd43adb5812254d684e6ddafd113d1877f7 SHA256 c91bdb1c434fb71a1aa7df3d87466010a32a9f6293dba466c3a5401c2cc6a4db
AUX tar.1 16821 RMD160 f58bc7cfeeee0cc811a6c2b5dd1dffe8b197231e SHA1 b354f0803c03cd59fe24f93d532f27f6f0136316 SHA256 f3558b444ab9427c06bc92838c29194051ed64edd0a909163cfa715cc7e6dcdd
DIST tar-1.26.tar.bz2 2339773 RMD160 d507dc5a57a823701cae5cdd2b98aba48ec74d3f SHA1 70f298c3cd997b694864c55e6d8655324c87a0cc SHA256 5a5369f464502a598e938029c310d4b3abd51e6bb8dfd045663e61c8ea9f6d41
-EBUILD tar-1.26-r2.ebuild 2191 RMD160 25ccbf49526eafd77ed3e712a7247b814a30658a SHA1 e5e864d1ba573b19bf1bc78205adc0e03dfa7c8d SHA256 48dd8230bf637d02b9b6e1cdc0307c04f915c05d9aeee09cfde51c5bbb431868
-MISC ChangeLog 511 RMD160 372a29f855c10e98e5a6a18f2da5963fa6ea021b SHA1 d644b6856e38d1194f18d6d0fcb36975798f6f49 SHA256 7279a303ba9bd4623b1296caa8036836d948060d840cc28ff23a47cba32dcf49
+EBUILD tar-1.26-r3.ebuild 2282 RMD160 dd4d0693d87ed493eba1b0c68d6e648f822486e4 SHA1 b53d5b82a490c76a4c92a6c9adbb4cd61a1fcf56 SHA256 88c4db4c1b9bbb39b6c0cb60594881a36dfd396c0690e9864f49b199bf97ac65
+MISC ChangeLog 768 RMD160 cadfa697d35001b45b5122c305f4df280a11a8c5 SHA1 30b82d62ac8240365e1489da63472d85e615e71d SHA256 14427c79b4ed75dc7f291aaec5a0c6065c6576b4e0e108b0efecbd6131c7c955
MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
-iEYEAREIAAYFAk5+FCYACgkQl5yvQNBFVTXj2wCdEaiNZKbO+GIL1uStY/sZVKZ9
-K7kAoIe/b8PDL6StwnWtsS5O2NedavF3
-=ufJW
+iEYEAREIAAYFAk5+O7AACgkQl5yvQNBFVTVzCwCfSpsPn/7zkb8GjqBx3+SfKeDl
+0e0An0c+5ElPYu2oL2w5AFISil7fMReK
+=9FpO
-----END PGP SIGNATURE-----
diff --git a/app-arch/tar/files/tar-1.26-xattr.patch b/app-arch/tar/files/tar-1.26-full-xattr.patch
similarity index 100%
rename from app-arch/tar/files/tar-1.26-xattr.patch
rename to app-arch/tar/files/tar-1.26-full-xattr.patch
diff --git a/app-arch/tar/tar-1.26-r2.ebuild b/app-arch/tar/tar-1.26-r3.ebuild
similarity index 91%
rename from app-arch/tar/tar-1.26-r2.ebuild
rename to app-arch/tar/tar-1.26-r3.ebuild
index cc6033f..4049bac 100644
--- a/app-arch/tar/tar-1.26-r2.ebuild
+++ b/app-arch/tar/tar-1.26-r3.ebuild
@@ -15,14 +15,14 @@ SRC_URI="http://ftp.gnu.org/gnu/tar/${P}.tar.bz2
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="nls static userland_GNU xattr"
+IUSE="nls static userland_GNU acl caps selinux xattr"
RDEPEND=""
DEPEND="${RDEPEND}
nls? ( >=sys-devel/gettext-0.10.35 )"
src_prepare() {
- epatch "${FILESDIR}"/${P}-xattr.patch #382067
+ epatch "${FILESDIR}"/${P}-full-xattr.patch #382067
eautoreconf
if ! use userland_GNU ; then
@@ -37,6 +37,9 @@ src_configure() {
local myconf
use static && append-ldflags -static
use userland_GNU || myconf="--program-prefix=g"
+ if use acl || use caps || use selinux || use xattr ; then
+ myconf+=" --enable-xattr"
+ fi
# Work around bug in sandbox #67051
gl_cv_func_chown_follows_symlink=yes \
FORCE_UNSAFE_CONFIGURE=1 \
@@ -45,7 +48,6 @@ src_configure() {
--bindir="${EPREFIX}"/bin \
--libexecdir="${EPREFIX}"/usr/sbin \
$(use_enable nls) \
- $(use_enable xattr)
${myconf}
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] dev/blueness:master commit in: app-arch/tar/files/, app-arch/tar/
@ 2013-05-09 23:33 Anthony G. Basile
0 siblings, 0 replies; 4+ messages in thread
From: Anthony G. Basile @ 2013-05-09 23:33 UTC (permalink / raw
To: gentoo-commits
commit: f93fbc308f0484f84eefb15b48c1e119aab1bb43
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu May 9 23:32:57 2013 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu May 9 23:32:57 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/blueness.git;a=commit;h=f93fbc30
app-arch/tar-1.26-r1: in the tree and stable with xattr patch
Package-Manager: portage-2.1.11.62
Manifest-Sign-Key: 0xF52D4BBA
---
app-arch/tar/ChangeLog | 24 -
app-arch/tar/Manifest | 17 -
app-arch/tar/files/rmt | 8 -
app-arch/tar/files/tar-1.26-full-xattr.patch | 953 --------------------------
app-arch/tar/files/tar.1 | 816 ----------------------
app-arch/tar/metadata.xml | 5 -
app-arch/tar/tar-1.26-r3.ebuild | 76 --
7 files changed, 0 insertions(+), 1899 deletions(-)
diff --git a/app-arch/tar/ChangeLog b/app-arch/tar/ChangeLog
deleted file mode 100644
index 1106a6b..0000000
--- a/app-arch/tar/ChangeLog
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-*tar-1.26-r3 (24 Sep 2011)
-
- 24 Sep 2011; Anthony G. Basile <blueness@gentoo.org> -tar-1.26-r2.ebuild,
- +tar-1.26-r3.ebuild, +files/tar-1.26-full-xattr.patch,
- -files/tar-1.26-xattr.patch:
- Added USE="acl caps selinux xattr" flags which --enable-xattr
-
-*tar-1.26-r2 (24 Sep 2011)
-
- 24 Sep 2011; Anthony G. Basile <blueness@gentoo.org> -tar-1.26-r1.ebuild,
- +tar-1.26-r2.ebuild, files/tar-1.26-xattr.patch:
- Switching to USE="xattr" for xattr only patch - bug #382067
-
- 10 Sep 2011; Anthony G. Basile <blueness@gentoo.org> tar-1.26-r1.ebuild:
- Switching to USE="selinux"
-
-*tar-1.26 (10 Sep 2011)
-
- 10 Sep 2011; Anthony G. Basile <blueness@gentoo.org> +tar-1.26-r1.ebuild,
- +files/tar-1.26-xattrs.patch, +files/rmt, +files/tar.1:
- Testing for bug #382067
-
diff --git a/app-arch/tar/Manifest b/app-arch/tar/Manifest
deleted file mode 100644
index 4ec38b5..0000000
--- a/app-arch/tar/Manifest
+++ /dev/null
@@ -1,17 +0,0 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA256
-
-AUX rmt 263 SHA256 c0371cb0243a190b6bb43609c86dfb4cd637882d4ff3ff9651ca7ec8d6b59355 SHA512 2f1a9d3a522fc1f0d5385d1ea4c27da88a1c9357b866340432c6310604c01d3e328e33080ed1e951c0da6f025c3ee2a0c9f170d4b86a1d235ebb56be48fef152 WHIRLPOOL 11869239f2ebbb237f8429d1f13f146fd2414e90edc2475d190f16659d052d3ac949d717939dcfc815a30942855fb26e60b6b506104876ccad32747191b04727
-AUX tar-1.26-full-xattr.patch 30674 SHA256 c91bdb1c434fb71a1aa7df3d87466010a32a9f6293dba466c3a5401c2cc6a4db SHA512 8614a35a8137c8025b29804d58f9fec430bdf52dc56f828d3f634f889c8af4f63b0c918943cfe7952c8fdac771056b23b6a8b5b273ddf282be8d4290e9e4add0 WHIRLPOOL c27396aae0d7bcf67cd11cfa33eab6fd5fe58894a779153d50f798e2fe363a44fc82e24504ec743a3848c4f82c0f18877ac4ecd38d2dc8f961300faaf81f167e
-AUX tar.1 16821 SHA256 f3558b444ab9427c06bc92838c29194051ed64edd0a909163cfa715cc7e6dcdd SHA512 1b76fcecaf95bb68c4e2e0e94c3f1dc2bf6e3cb0191afc3cdfb9d69ded3d78052ba9131dc7c360dd58f36e943fdc54a9b93018f0b1fa7a3d215753dbea6643f8 WHIRLPOOL 43cb033ee95fe6823f04b8032784d9825447a49a4a82ff028a587ac1521e1c13613ae6a43e5a1f3d85226b232bd343e2c78f8d427dcee99272b5e627613d245c
-DIST tar-1.26.tar.bz2 2339773 SHA256 5a5369f464502a598e938029c310d4b3abd51e6bb8dfd045663e61c8ea9f6d41
-EBUILD tar-1.26-r3.ebuild 2199 SHA256 2f01d9828e3b0158c8bc367024f57bcdf183a3ab9003d5d225053c64610d372b SHA512 577e7fe5bd6b0b8375166308a88623aaf8d151f5763cd3f3328b110ef8dc6dc9337dcedf9ec09e643aef58cfcf053a3341b333095126589da3fcd3bda0ec6a3b WHIRLPOOL 7c740a4e3f4a33e56133228304a6bf925d5745d293826b198eb32201373e15a02ce7c8a8212294d72920ddb14324f28193e3a8e2ba2005a6b61d290779ec6563
-MISC ChangeLog 768 SHA256 14427c79b4ed75dc7f291aaec5a0c6065c6576b4e0e108b0efecbd6131c7c955 SHA512 b4c7921b878e3c127be7e2ef999f4ac3e3e358d8a34741da2a857d162f0991fa318b4d65d9981e617fa87fdefd1dedd7361dbeb6395ba89514dacb2c014b4834 WHIRLPOOL 2c318d1fcdb856044984850d3d662b2ffcf08d1f997e09ec5bbb44651c741b5ceff5e9017d05deb3e31e2c04e6edf5d11dd95a04c029d502aa5d2247d648817d
-MISC metadata.xml 164 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92 SHA512 8eb0d5153d388f6ea069c64b93882244816a0a09aecc0d73cb872121ce0eb24c5ccafa96aad0b620b2300f319e1af101fa7fa6c5d0d561719d49bb07da0a2eca WHIRLPOOL 11a1441bddb7a6c69653c663902b7da5767ae6ad515ac2aabfc42fe37927a1ccc21472deeee454009ff720201a41c3e4a912df42661a0a87150fb46126da2d52
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.19 (GNU/Linux)
-
-iEYEAREIAAYFAlCJlGUACgkQl5yvQNBFVTW22ACfa15DgU8v/6i4OJwFxioeqxQh
-s+oAn3X4XxVubOMT4KNmMfEvGQjMapOu
-=EPl3
------END PGP SIGNATURE-----
diff --git a/app-arch/tar/files/rmt b/app-arch/tar/files/rmt
deleted file mode 100644
index 15ed6aa..0000000
--- a/app-arch/tar/files/rmt
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-# This is not a mistake. This shell script (/etc/rmt) has been provided
-# for compatibility with other Unix-like systems, some of which have
-# utilities that expect to find (and execute) rmt in the /etc directory
-# on remote systems.
-#
-exec rmt "$@"
diff --git a/app-arch/tar/files/tar-1.26-full-xattr.patch b/app-arch/tar/files/tar-1.26-full-xattr.patch
deleted file mode 100644
index 7a5c7f8..0000000
--- a/app-arch/tar/files/tar-1.26-full-xattr.patch
+++ /dev/null
@@ -1,953 +0,0 @@
-diff --git a/configure.ac b/configure.ac
-index db69cb8..2afa463 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -223,6 +223,20 @@ AC_CHECK_TYPE(iconv_t,:,
- #endif
- ])
-
-+AC_ARG_ENABLE(xattr,
-+ AC_HELP_STRING([--enable-xattr],
-+ [enable Extended Attribute support (disabled by default)]),
-+ [xattr_enabled=$enableval],
-+ [xattr_enabled=no])
-+
-+if test "x$xattr_enabled" = xyes; then
-+ AC_CHECK_HEADERS(attr/xattr.h)
-+ AC_CHECK_FUNCS(getxattr fgetxattr lgetxattr \
-+ setxattr fsetxattr lsetxattr \
-+ listxattr flistxattr llistxattr,
-+ AC_DEFINE(HAVE_XATTRS,1,[Define if we have a working extended attributes]),)
-+fi
-+
- # Gettext.
- AM_GNU_GETTEXT([external], [need-formatstring-macros])
- AM_GNU_GETTEXT_VERSION([0.16])
-diff --git a/doc/tar.texi b/doc/tar.texi
-index db8f986..d861d12 100644
---- a/doc/tar.texi
-+++ b/doc/tar.texi
-@@ -3002,6 +3002,10 @@ mechanism.
- 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 and not to extract xattrs. @xref{Attributes}.
-+
- @opsummary{no-wildcards}
- @item --no-wildcards
- Do not use wildcards.
-@@ -3447,6 +3451,10 @@ 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 xattrs. @xref{Attributes}.
-+
- @opsummary{wildcards}
- @item --wildcards
- Use wildcards when matching member names with patterns.
-@@ -8659,6 +8667,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{}.
-@@ -9293,6 +9303,20 @@ 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 the current extended attributes in
-+the archive.
-+
-+The @option{--xattrs} option has no equivalent short option name.
-+
-+@opindex no-xattrs
-+@item --no-xattrs
-+This option causes @command{tar} not to store the current extended attributes in
-+the archive and not to extract any extended attributes in an archive.
-+
-+The @option{--no-xattrs} option has no equivalent short option name.
-+
- @end table
-
- @node Portability
-diff --git a/src/Makefile.am b/src/Makefile.am
-index de310f4..27c28be 100644
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -20,7 +20,7 @@
-
- bin_PROGRAMS = tar
-
--noinst_HEADERS = arith.h common.h tar.h
-+noinst_HEADERS = arith.h common.h tar.h xattrs.h
- tar_SOURCES = \
- buffer.c\
- checkpoint.c\
-@@ -42,10 +42,11 @@ tar_SOURCES = \
- unlink.c\
- update.c\
- utf8.c\
-- warning.c
-+ warning.c\
-+ xattrs.c
-
- INCLUDES = -I$(top_srcdir)/gnu -I../ -I../gnu -I$(top_srcdir)/lib -I../lib
-
- LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV)
-
--tar_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)
-+tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)
-diff --git a/src/common.h b/src/common.h
-index 0b9bd7a..e4ee345 100644
---- a/src/common.h
-+++ b/src/common.h
-@@ -253,6 +253,9 @@ GLOBAL int same_owner_option;
- /* If positive, preserve permissions when extracting. */
- GLOBAL int same_permissions_option;
-
-+/* If positive, save the user and root xattrs. */
-+GLOBAL int xattrs_option;
-+
- /* When set, strip the given number of file name components from the file name
- before extracting */
- GLOBAL size_t strip_name_components;
-@@ -707,6 +710,9 @@ extern char *output_start;
-
- void update_archive (void);
-
-+/* Module attrs.c. */
-+#include "xattrs.h"
-+
- /* Module xheader.c. */
-
- void xheader_decode (struct tar_stat_info *stat);
-@@ -727,6 +733,12 @@ bool xheader_string_end (struct xheader *xhdr, char const *keyword);
- bool xheader_keyword_deleted_p (const char *kw);
- char *xheader_format_name (struct tar_stat_info *st, const char *fmt,
- size_t n);
-+void xheader_xattr_init(struct tar_stat_info *st);
-+void xheader_xattr_free(struct xattr_array *vals, size_t sz);
-+void xheader_xattr_copy(const struct tar_stat_info *st,
-+ struct xattr_array **vals, size_t *sz);
-+void xheader_xattr_add(struct tar_stat_info *st,
-+ const char *key, const char *val, size_t len);
-
- /* Module system.c */
-
-diff --git a/src/create.c b/src/create.c
-index 43b5a4c..7ed5d10 100644
---- a/src/create.c
-+++ b/src/create.c
-@@ -936,6 +936,21 @@ start_header (struct tar_stat_info *st)
- GNAME_TO_CHARS (st->gname, header->header.gname);
- }
-
-+ if (archive_format == POSIX_FORMAT)
-+ {
-+ if (xattrs_option > 0)
-+ {
-+ size_t scan_xattr = 0;
-+ struct xattr_array *xattr_map = st->xattr_map;
-+
-+ while (scan_xattr < st->xattr_map_size)
-+ {
-+ xheader_store (xattr_map[scan_xattr].xkey, st, &scan_xattr);
-+ ++scan_xattr;
-+ }
-+ }
-+ }
-+
- return header;
- }
-
-@@ -1711,6 +1726,11 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
- bool ok;
- struct stat final_stat;
-
-+ if (fd == 0)
-+ xattrs_xattrs_get(st, p, -1);
-+ else
-+ xattrs_xattrs_get(st, p, fd);
-+
- if (is_dir)
- {
- const char *tag_file_name;
-@@ -1829,6 +1849,8 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
- if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size)
- write_long_link (st);
-
-+ xattrs_xattrs_get(st, p, -1);
-+
- block_ordinal = current_block_ordinal ();
- st->stat.st_size = 0; /* force 0 size on symlink */
- header = start_header (st);
-@@ -1847,11 +1869,20 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
- }
- #endif
- else if (S_ISCHR (st->stat.st_mode))
-- type = CHRTYPE;
-+ {
-+ type = CHRTYPE;
-+ xattrs_xattrs_get(st, p, -1);
-+ }
- else if (S_ISBLK (st->stat.st_mode))
-- type = BLKTYPE;
-+ {
-+ type = BLKTYPE;
-+ xattrs_xattrs_get(st, p, -1);
-+ }
- else if (S_ISFIFO (st->stat.st_mode))
-- type = FIFOTYPE;
-+ {
-+ type = FIFOTYPE;
-+ xattrs_xattrs_get(st, p, -1);
-+ }
- else if (S_ISSOCK (st->stat.st_mode))
- {
- WARNOPT (WARN_FILE_IGNORED,
-diff --git a/src/extract.c b/src/extract.c
-index aaea56e..5c0a9c9 100644
---- a/src/extract.c
-+++ b/src/extract.c
-@@ -97,6 +97,9 @@ struct delayed_set_stat
- /* Directory that the name is relative to. */
- int change_dir;
-
-+ /* extended attributes*/
-+ size_t xattr_map_size; /* Size of the xattr map */
-+ struct xattr_array *xattr_map;
- /* Length and contents of name. */
- size_t file_name_len;
- char file_name[1];
-@@ -134,6 +137,9 @@ struct delayed_link
- hard-linked together. */
- struct string_list *sources;
-
-+ size_t xattr_map_size; /* Size of the xattr map */
-+ struct xattr_array *xattr_map;
-+
- /* The desired target of the desired link. */
- char target[1];
- };
-@@ -335,6 +341,8 @@ set_stat (char const *file_name,
- utime_error (file_name);
- }
-
-+ xattrs_xattrs_set(st, file_name, typeflag);
-+
- if (0 < same_owner_option && ! interdir)
- {
- /* Some systems allow non-root users to give files away. Once this
-@@ -431,6 +439,13 @@ delay_set_stat (char const *file_name, struct tar_stat_info const *st,
- data->atflag = atflag;
- data->after_links = 0;
- data->change_dir = chdir_current;
-+ if (st)
-+ xheader_xattr_copy (st, &data->xattr_map, &data->xattr_map_size);
-+ else
-+ {
-+ data->xattr_map = NULL;
-+ data->xattr_map_size = 0;
-+ }
- strcpy (data->file_name, file_name);
- delayed_set_stat_head = data;
- if (must_be_dot_or_slash (file_name))
-@@ -673,6 +688,31 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
- return RECOVER_NO;
- }
-
-+/* Restore stat extended attributes (xattr) for FILE_NAME, using information
-+ given in *ST. Restore before extraction because they may affect layout.
-+ 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 */
-+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;
-+ bool interdir_made = false;
-+
-+ if ((xattrs_option >= 0) && st->xattr_map_size) {
-+ mode_t mode = current_stat_info.stat.st_mode & MODE_RWX & ~ current_umask;
-+
-+ do
-+ status = mknod (file_name, mode ^ invert_permissions, 0);
-+ while (status && maybe_recoverable ((char *)file_name, false, &interdir_made));
-+ xattrs_xattrs_set(st, file_name, typeflag);
-+ *file_created = 1;
-+ }
-+ return(status);
-+}
-+
- /* Fix the statuses of all directories whose statuses need fixing, and
- which are not ancestors of FILE_NAME. If AFTER_LINKS is
- nonzero, do this for all such directories; otherwise, stop at the
-@@ -733,12 +773,15 @@ apply_nonancestor_delayed_set_stat (char const *file_name, bool after_links)
- sb.stat.st_gid = data->gid;
- sb.atime = data->atime;
- sb.mtime = data->mtime;
-+ sb.xattr_map = data->xattr_map;
-+ sb.xattr_map_size = data->xattr_map_size;
- set_stat (data->file_name, &sb,
- -1, current_mode, current_mode_mask,
- DIRTYPE, data->interdir, data->atflag);
- }
-
- delayed_set_stat_head = data->next;
-+ xheader_xattr_free (data->xattr_map, data->xattr_map_size);
- free (data);
- }
- }
-@@ -854,6 +897,7 @@ extract_dir (char *file_name, int typeflag)
-
- static int
- open_output_file (char const *file_name, int typeflag, mode_t mode,
-+ int file_created,
- mode_t *current_mode, mode_t *current_mode_mask)
- {
- int fd;
-@@ -864,6 +908,10 @@ open_output_file (char const *file_name, int typeflag, mode_t mode,
- ? O_TRUNC | (dereference_option ? 0 : O_NOFOLLOW)
- : O_EXCL));
-
-+ /* File might be created in set_xattr. So clear O_EXCL to avoid open() failure */
-+ if (file_created)
-+ openflag = openflag & ~O_EXCL;
-+
- if (typeflag == CONTTYPE)
- {
- static int conttype_diagnosed;
-@@ -934,6 +982,7 @@ extract_file (char *file_name, int typeflag)
- bool interdir_made = false;
- mode_t mode = (current_stat_info.stat.st_mode & MODE_RWX
- & ~ (0 < same_owner_option ? S_IRWXG | S_IRWXO : 0));
-+ mode_t invert_permissions = 0 < same_owner_option ? mode & (S_IRWXG | S_IRWXO) : 0;
- mode_t current_mode = 0;
- mode_t current_mode_mask = 0;
-
-@@ -950,7 +999,17 @@ extract_file (char *file_name, int typeflag)
- }
- else
- {
-+ int file_created = 0;
-+ if (set_xattr (file_name, ¤t_stat_info, invert_permissions,
-+ typeflag, &file_created))
-+ {
-+ skip_member ();
-+ open_error (file_name);
-+ return 1;
-+ }
-+
- while ((fd = open_output_file (file_name, typeflag, mode,
-+ file_created,
- ¤t_mode, ¤t_mode_mask))
- < 0)
- {
-@@ -1091,6 +1150,7 @@ create_placeholder_file (char *file_name, bool is_symlink, bool *interdir_made)
- + strlen (file_name) + 1);
- p->sources->next = 0;
- strcpy (p->sources->string, file_name);
-+ xheader_xattr_copy (¤t_stat_info, &p->xattr_map, &p->xattr_map_size);
- strcpy (p->target, current_stat_info.link_name);
-
- h = delayed_set_stat_head;
-@@ -1525,6 +1585,8 @@ apply_delayed_links (void)
- st1.stat.st_gid = ds->gid;
- st1.atime = ds->atime;
- st1.mtime = ds->mtime;
-+ st1.xattr_map = ds->xattr_map;
-+ st1.xattr_map_size = ds->xattr_map_size;
- set_stat (source, &st1, -1, 0, 0, SYMTYPE,
- false, AT_SYMLINK_NOFOLLOW);
- valid_source = source;
-@@ -1539,6 +1601,8 @@ apply_delayed_links (void)
- sources = next;
- }
-
-+ xheader_xattr_free (ds->xattr_map, ds->xattr_map_size);
-+
- {
- struct delayed_link *next = ds->next;
- free (ds);
-diff --git a/src/list.c b/src/list.c
-index cf2de09..6f52579 100644
---- a/src/list.c
-+++ b/src/list.c
-@@ -604,6 +604,8 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
- assign_string (&stat_info->gname,
- header->header.gname[0] ? header->header.gname : NULL);
-
-+ xheader_xattr_init(stat_info);
-+
- if (format == OLDGNU_FORMAT && incremental_option)
- {
- stat_info->atime.tv_sec = TIME_FROM_HEADER (header->oldgnu_header.atime);
-diff --git a/src/tar.c b/src/tar.c
-index 928cfdd..75510d8 100644
---- a/src/tar.c
-+++ b/src/tar.c
-@@ -304,6 +304,7 @@ enum
- NO_UNQUOTE_OPTION,
- NO_WILDCARDS_MATCH_SLASH_OPTION,
- NO_WILDCARDS_OPTION,
-+ NO_XATTR_OPTION,
- NULL_OPTION,
- NUMERIC_OWNER_OPTION,
- OCCURRENCE_OPTION,
-@@ -340,7 +341,8 @@ enum
- VOLNO_FILE_OPTION,
- WARNING_OPTION,
- WILDCARDS_MATCH_SLASH_OPTION,
-- WILDCARDS_OPTION
-+ WILDCARDS_OPTION,
-+ XATTR_OPTION
- };
-
- const char *argp_program_version = "tar (" PACKAGE_NAME ") " VERSION;
-@@ -516,6 +518,10 @@ static struct argp_option options[] = {
- {"preserve-order", 's', 0, 0,
- N_("sort names to extract to match archive"), GRID+1 },
- {"same-order", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
-+ {"xattrs", XATTR_OPTION, 0, 0,
-+ N_("Save the user/root xattrs to the archive"), GRID+1 },
-+ {"no-xattrs", NO_XATTR_OPTION, 0, 0,
-+ N_("Don't extract the user/root xattrs from the archive"), GRID+1 },
- {"preserve", PRESERVE_OPTION, 0, 0,
- N_("same as both -p and -s"), GRID+1 },
- {"delay-directory-restore", DELAY_DIRECTORY_RESTORE_OPTION, 0, 0,
-@@ -2079,6 +2085,15 @@ parse_opt (int key, char *arg, struct argp_state *state)
- same_permissions_option = -1;
- break;
-
-+ case XATTR_OPTION:
-+ set_archive_format ("posix");
-+ xattrs_option = 1;
-+ break;
-+
-+ case NO_XATTR_OPTION:
-+ xattrs_option = -1;
-+ break;
-+
- case RECURSION_OPTION:
- recursion_option = FNM_LEADING_DIR;
- break;
-@@ -2461,6 +2476,15 @@ decode_options (int argc, char **argv)
- || subcommand_option != LIST_SUBCOMMAND))
- USAGE_ERROR ((0, 0, _("--pax-option can be used only on POSIX archives")));
-
-+ /* star create's non-POSIX typed archives with xattr support, so allow the
-+ extra headers */
-+ if ((xattrs_option > 0)
-+ && archive_format != POSIX_FORMAT
-+ && (subcommand_option != EXTRACT_SUBCOMMAND
-+ || subcommand_option != DIFF_SUBCOMMAND
-+ || subcommand_option != LIST_SUBCOMMAND))
-+ USAGE_ERROR ((0, 0, _("--xattrs can be used only on POSIX archives")));
-+
- /* If ready to unlink hierarchies, so we are for simpler files. */
- if (recursive_unlink_option)
- old_files_option = UNLINK_FIRST_OLD_FILES;
-@@ -2713,6 +2737,7 @@ void
- tar_stat_destroy (struct tar_stat_info *st)
- {
- tar_stat_close (st);
-+ xheader_xattr_free (st->xattr_map, st->xattr_map_size);
- free (st->orig_file_name);
- free (st->file_name);
- free (st->link_name);
-diff --git a/src/tar.h b/src/tar.h
-index ce9850c..955b18e 100644
---- a/src/tar.h
-+++ b/src/tar.h
-@@ -276,6 +276,14 @@ struct xheader
- uintmax_t string_length;
- };
-
-+/* Information about xattrs for a file. */
-+struct xattr_array
-+ {
-+ char *xkey;
-+ char *xval_ptr;
-+ size_t xval_len;
-+ };
-+
- struct tar_stat_info
- {
- char *orig_file_name; /* name of file read from the archive header */
-@@ -287,6 +295,7 @@ struct tar_stat_info
-
- char *uname; /* user name of owner */
- char *gname; /* group name of owner */
-+
- struct stat stat; /* regular filesystem stat */
-
- /* STAT doesn't always have access, data modification, and status
-@@ -309,6 +318,9 @@ struct tar_stat_info
- size_t sparse_map_size; /* Size of the sparse map */
- struct sp_array *sparse_map;
-
-+ size_t xattr_map_size; /* Size of the xattr map */
-+ struct xattr_array *xattr_map;
-+
- /* Extended headers */
- struct xheader xhdr;
-
-diff --git a/src/xattrs.c b/src/xattrs.c
-new file mode 100644
-index 0000000..6a9950e
---- /dev/null
-+++ b/src/xattrs.c
-@@ -0,0 +1,181 @@
-+/* Create a tar archive.
-+
-+ Copyright (C) 2006 Free Software Foundation, Inc.
-+
-+ Written by James Antill, on 2006-07-27.
-+
-+ 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 2, 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. */
-+
-+#include <system.h>
-+
-+#include <quotearg.h>
-+
-+#include "common.h"
-+
-+
-+#ifndef HAVE_ATTR_XATTR_H
-+# undef HAVE_XATTRS
-+#endif
-+
-+#ifdef HAVE_ATTR_XATTR_H
-+# include <attr/xattr.h>
-+#endif
-+
-+
-+void xattrs_xattrs_get(struct tar_stat_info *st, char const *file_name, int fd)
-+{
-+ if (xattrs_option > 0)
-+ { /* get all xattrs ... this include security.* and system.* if
-+ available. We filter them here, but we have to filter them
-+ in xattrs_xattrs_set() anyway.
-+ */
-+ static ssize_t xsz = 1024;
-+ static char *xatrs = NULL;
-+ ssize_t xret = -1;
-+
-+#ifndef HAVE_XATTRS
-+ static int done = 0;
-+ if ((xattrs_option > 0) && !done)
-+ WARN ((0, 0, _("Xattr support requested, but not available")));
-+ done = 1;
-+#else
-+
-+ if (!xatrs) xatrs = xmalloc (xsz);
-+
-+ while (((fd == -1) ?
-+ ((xret = llistxattr (file_name, xatrs, xsz)) == -1) :
-+ ((xret = flistxattr (fd, xatrs, xsz)) == -1)) &&
-+ (errno == ERANGE))
-+ {
-+ xsz <<= 1;
-+ xatrs = xrealloc (xatrs, xsz);
-+ }
-+
-+ if (xret == -1)
-+ call_arg_warn ((fd == -1) ? "llistxattrs" : "flistxattrs", file_name);
-+ else
-+ {
-+ const char *attr = xatrs;
-+ static ssize_t asz = 1024;
-+ static char *val = NULL;
-+
-+ if (!val) val = xmalloc (asz);
-+
-+ while (xret > 0)
-+ {
-+ 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 == -1) ?
-+ ((aret = lgetxattr (file_name, attr, val, asz)) == -1) :
-+ ((aret = fgetxattr (fd, attr, val, asz)) == -1)) &&
-+ (errno == ERANGE))
-+ {
-+ asz <<= 1;
-+ val = xrealloc (val, asz);
-+ }
-+
-+ if (aret != -1)
-+ xheader_xattr_add (st, attr, val, aret);
-+ else if (errno != ENOATTR)
-+ call_arg_warn ((fd==-1) ? "lgetxattr" : "fgetxattr", file_name);
-+
-+ attr += len + 1;
-+ xret -= len + 1;
-+ }
-+ }
-+#endif
-+ }
-+}
-+
-+static void xattrs__fd_set(struct tar_stat_info const *st,
-+ char const *file_name, char typeflag,
-+ const char *attr,
-+ const char *ptr, size_t len)
-+{
-+#ifdef HAVE_XATTRS
-+ if (ptr)
-+ {
-+ const char *sysname = "setxattr";
-+ int ret = -1;
-+
-+ if (typeflag != SYMTYPE)
-+ ret = setxattr (file_name, attr, ptr, len, 0);
-+ else
-+ {
-+ sysname = "lsetxattr";
-+ ret = lsetxattr (file_name, attr, ptr, len, 0);
-+ }
-+
-+ /* do not print warnings when SELinux is disabled */
-+ if ((ret == -1) && (errno != EPERM) && (errno != ENOTSUP))
-+ call_arg_error(sysname, file_name);
-+ }
-+#endif
-+}
-+
-+static char *skip_to_ext_fields(char *ptr)
-+{
-+ ptr += strcspn(ptr, ":,\n"); /* skip tag name. Ie. user/group/default/mask */
-+
-+ if (*ptr != ':')
-+ return (ptr); /* error? no user/group field */
-+ ++ptr;
-+
-+ ptr += strcspn(ptr, ":,\n"); /* skip user/group name */
-+
-+ if (*ptr != ':')
-+ return (ptr); /* error? no perms field */
-+ ++ptr;
-+
-+ ptr += strcspn(ptr, ":,\n"); /* skip perms */
-+
-+ if (*ptr != ':')
-+ return (ptr); /* no extra fields */
-+
-+ return (ptr);
-+}
-+
-+void xattrs_xattrs_set(struct tar_stat_info const *st,
-+ char const *file_name, char typeflag)
-+{
-+ if ((xattrs_option >= 0) && st->xattr_map_size)
-+ {
-+ size_t scan = 0;
-+
-+#ifndef HAVE_XATTRS
-+ static int done = 0;
-+ if (!done)
-+ WARN ((0, 0, _("Xattr support requested, but not available")));
-+ done = 1;
-+#else
-+ while (scan < st->xattr_map_size)
-+ {
-+ char *keyword = st->xattr_map[scan].xkey;
-+
-+ /* assert (!memcpy (keyword, "SCHILY.xattr.", strlen("SCHILY.xattr."))); */
-+ keyword += strlen("SCHILY.xattr.");
-+
-+ xattrs__fd_set (st, file_name, typeflag, keyword,
-+ st->xattr_map[scan].xval_ptr,
-+ st->xattr_map[scan].xval_len);
-+
-+ ++scan;
-+ }
-+#endif
-+ }
-+}
-diff --git a/src/xattrs.h b/src/xattrs.h
-new file mode 100644
-index 0000000..7ffdce1
---- /dev/null
-+++ b/src/xattrs.h
-@@ -0,0 +1,6 @@
-+
-+extern void xattrs_xattrs_get(struct tar_stat_info *st,
-+ char const *file_name, int fd);
-+
-+extern void xattrs_xattrs_set(struct tar_stat_info const *st,
-+ char const *file_name, char typeflag);
-diff --git a/src/xheader.c b/src/xheader.c
-index 2284e97..557b3e5 100644
---- a/src/xheader.c
-+++ b/src/xheader.c
-@@ -460,6 +460,74 @@ xheader_write_global (struct xheader *xhdr)
- }
- }
-
-+void xheader_xattr_init(struct tar_stat_info *st)
-+{
-+ st->xattr_map = NULL;
-+ st->xattr_map_size = 0;
-+}
-+
-+void xheader_xattr_free(struct xattr_array *xattr_map, size_t xattr_map_size)
-+{
-+ size_t scan = 0;
-+
-+ while (scan < xattr_map_size)
-+ {
-+ free (xattr_map[scan].xkey);
-+ free (xattr_map[scan].xval_ptr);
-+
-+ ++scan;
-+ }
-+ free (xattr_map);
-+}
-+
-+static void xheader_xattr__add(struct xattr_array **xattr_map,
-+ size_t *xattr_map_size,
-+ const char *key, const char *val, size_t len)
-+{
-+ size_t pos = (*xattr_map_size)++;
-+
-+ *xattr_map = xrealloc (*xattr_map,
-+ *xattr_map_size * sizeof(struct xattr_array));
-+ (*xattr_map)[pos].xkey = xstrdup (key);
-+ (*xattr_map)[pos].xval_ptr = xmemdup (val, len + 1);
-+ (*xattr_map)[pos].xval_len = len;
-+}
-+
-+void xheader_xattr_add(struct tar_stat_info *st,
-+ const char *key, const char *val, size_t len)
-+{
-+ size_t klen = strlen (key);
-+ char *xkey = xmalloc (strlen("SCHILY.xattr.") + klen + 1);
-+ char *tmp = xkey;
-+
-+ tmp = stpcpy (tmp, "SCHILY.xattr.");
-+ tmp = stpcpy (tmp, key);
-+
-+ xheader_xattr__add (&st->xattr_map, &st->xattr_map_size, xkey, val, len);
-+
-+ free (xkey);
-+}
-+
-+void xheader_xattr_copy(const struct tar_stat_info *st,
-+ struct xattr_array **xattr_map, size_t *xattr_map_size)
-+{
-+ size_t scan = 0;
-+
-+ *xattr_map = NULL;
-+ *xattr_map_size = 0;
-+
-+ while (scan < st->xattr_map_size)
-+ {
-+ char *key = st->xattr_map[scan].xkey;
-+ char *val = st->xattr_map[scan].xval_ptr;
-+ size_t len = st->xattr_map[scan].xval_len;
-+
-+ xheader_xattr__add(xattr_map, xattr_map_size, key, val, len);
-+
-+ ++scan;
-+ }
-+}
-+
- \f
- /* General Interface */
-
-@@ -473,6 +541,7 @@ struct xhdr_tab
- struct xheader *, void const *data);
- void (*decoder) (struct tar_stat_info *, char const *, char const *, size_t);
- int flags;
-+ bool prefix;
- };
-
- /* This declaration must be extern, because ISO C99 section 6.9.2
-@@ -489,8 +558,17 @@ locate_handler (char const *keyword)
- struct xhdr_tab const *p;
-
- for (p = xhdr_tab; p->keyword; p++)
-- if (strcmp (p->keyword, keyword) == 0)
-- return p;
-+ if (p->prefix)
-+ {
-+ if (strncmp (p->keyword, keyword, strlen(p->keyword)) == 0)
-+ return p;
-+ }
-+ else
-+ {
-+ if (strcmp (p->keyword, keyword) == 0)
-+ return p;
-+ }
-+
- return NULL;
- }
-
-@@ -500,7 +578,7 @@ xheader_protected_pattern_p (const char *pattern)
- struct xhdr_tab const *p;
-
- for (p = xhdr_tab; p->keyword; p++)
-- if ((p->flags & XHDR_PROTECTED) && fnmatch (pattern, p->keyword, 0) == 0)
-+ if (!p->prefix && (p->flags & XHDR_PROTECTED) && fnmatch (pattern, p->keyword, 0) == 0)
- return true;
- return false;
- }
-@@ -511,7 +589,7 @@ xheader_protected_keyword_p (const char *keyword)
- struct xhdr_tab const *p;
-
- for (p = xhdr_tab; p->keyword; p++)
-- if ((p->flags & XHDR_PROTECTED) && strcmp (p->keyword, keyword) == 0)
-+ if (!p->prefix && (p->flags & XHDR_PROTECTED) && strcmp (p->keyword, keyword) == 0)
- return true;
- return false;
- }
-@@ -1470,6 +1548,27 @@ volume_filename_decoder (struct tar_stat_info *st,
- }
-
- static void
-+xattr_coder (struct tar_stat_info const *st , char const *keyword,
-+ struct xheader *xhdr, void const *data)
-+{
-+ struct xattr_array *xattr_map = st->xattr_map;
-+ const size_t *off = data;
-+ xheader_print_n (xhdr, keyword,
-+ xattr_map[*off].xval_ptr, xattr_map[*off].xval_len);
-+}
-+
-+static void
-+xattr_decoder (struct tar_stat_info *st,
-+ char const *keyword, char const *arg, size_t size)
-+{
-+ char *xstr = NULL;
-+
-+ xstr = xmemdup(arg, size + 1);
-+ xheader_xattr_add(st, keyword + strlen("SCHILY.xattr."), xstr, size);
-+ free(xstr);
-+}
-+
-+static void
- sparse_major_coder (struct tar_stat_info const *st, char const *keyword,
- struct xheader *xhdr, void const *data)
- {
-@@ -1506,53 +1605,53 @@ sparse_minor_decoder (struct tar_stat_info *st,
- }
-
- struct xhdr_tab const xhdr_tab[] = {
-- { "atime", atime_coder, atime_decoder, 0 },
-- { "comment", dummy_coder, dummy_decoder, 0 },
-- { "charset", dummy_coder, dummy_decoder, 0 },
-- { "ctime", ctime_coder, ctime_decoder, 0 },
-- { "gid", gid_coder, gid_decoder, 0 },
-- { "gname", gname_coder, gname_decoder, 0 },
-- { "linkpath", linkpath_coder, linkpath_decoder, 0 },
-- { "mtime", mtime_coder, mtime_decoder, 0 },
-- { "path", path_coder, path_decoder, 0 },
-- { "size", size_coder, size_decoder, 0 },
-- { "uid", uid_coder, uid_decoder, 0 },
-- { "uname", uname_coder, uname_decoder, 0 },
-+ { "atime", atime_coder, atime_decoder, 0, false },
-+ { "comment", dummy_coder, dummy_decoder, 0, false },
-+ { "charset", dummy_coder, dummy_decoder, 0, false },
-+ { "ctime", ctime_coder, ctime_decoder, 0, false },
-+ { "gid", gid_coder, gid_decoder, 0, false },
-+ { "gname", gname_coder, gname_decoder, 0, false },
-+ { "linkpath", linkpath_coder, linkpath_decoder, 0, false },
-+ { "mtime", mtime_coder, mtime_decoder, 0, false },
-+ { "path", path_coder, path_decoder, 0, false },
-+ { "size", size_coder, size_decoder, 0, false },
-+ { "uid", uid_coder, uid_decoder, 0, false },
-+ { "uname", uname_coder, uname_decoder, 0, false },
-
- /* Sparse file handling */
- { "GNU.sparse.name", path_coder, path_decoder,
-- XHDR_PROTECTED },
-+ XHDR_PROTECTED, false },
- { "GNU.sparse.major", sparse_major_coder, sparse_major_decoder,
-- XHDR_PROTECTED },
-+ XHDR_PROTECTED, false },
- { "GNU.sparse.minor", sparse_minor_coder, sparse_minor_decoder,
-- XHDR_PROTECTED },
-+ XHDR_PROTECTED, false },
- { "GNU.sparse.realsize", sparse_size_coder, sparse_size_decoder,
-- XHDR_PROTECTED },
-+ XHDR_PROTECTED, false },
- { "GNU.sparse.numblocks", sparse_numblocks_coder, sparse_numblocks_decoder,
-- XHDR_PROTECTED },
-+ XHDR_PROTECTED, false },
-
- /* tar 1.14 - 1.15.90 keywords. */
- { "GNU.sparse.size", sparse_size_coder, sparse_size_decoder,
-- XHDR_PROTECTED },
-+ XHDR_PROTECTED, false },
- /* tar 1.14 - 1.15.1 keywords. Multiple instances of these appeared in 'x'
- headers, and each of them was meaningful. It confilcted with POSIX specs,
- which requires that "when extended header records conflict, the last one
- given in the header shall take precedence." */
- { "GNU.sparse.offset", sparse_offset_coder, sparse_offset_decoder,
-- XHDR_PROTECTED },
-+ XHDR_PROTECTED, false },
- { "GNU.sparse.numbytes", sparse_numbytes_coder, sparse_numbytes_decoder,
-- XHDR_PROTECTED },
-+ XHDR_PROTECTED, false },
- /* tar 1.15.90 keyword, introduced to remove the above-mentioned conflict. */
- { "GNU.sparse.map", NULL /* Unused, see pax_dump_header() */,
-- sparse_map_decoder, 0 },
-+ sparse_map_decoder, 0, false },
-
- { "GNU.dumpdir", dumpdir_coder, dumpdir_decoder,
-- XHDR_PROTECTED },
-+ XHDR_PROTECTED, false },
-
- /* Keeps the tape/volume label. May be present only in the global headers.
- Equivalent to GNUTYPE_VOLHDR. */
- { "GNU.volume.label", volume_label_coder, volume_label_decoder,
-- XHDR_PROTECTED | XHDR_GLOBAL },
-+ XHDR_PROTECTED | XHDR_GLOBAL, false },
-
- /* These may be present in a first global header of the archive.
- They provide the same functionality as GNUTYPE_MULTIVOL header.
-@@ -1561,11 +1660,14 @@ struct xhdr_tab const xhdr_tab[] = {
- GNU.volume.offset keeps the offset of the start of this volume,
- otherwise kept in oldgnu_header.offset. */
- { "GNU.volume.filename", volume_label_coder, volume_filename_decoder,
-- XHDR_PROTECTED | XHDR_GLOBAL },
-+ XHDR_PROTECTED | XHDR_GLOBAL, false },
- { "GNU.volume.size", volume_size_coder, volume_size_decoder,
-- XHDR_PROTECTED | XHDR_GLOBAL },
-+ XHDR_PROTECTED | XHDR_GLOBAL, false },
- { "GNU.volume.offset", volume_offset_coder, volume_offset_decoder,
-- XHDR_PROTECTED | XHDR_GLOBAL },
-+ XHDR_PROTECTED | XHDR_GLOBAL, false },
-+
-+ /* xattrs use the star format. note we only save some variants... */
-+ { "SCHILY.xattr", xattr_coder, xattr_decoder, 0, true },
-
-- { NULL, NULL, NULL, 0 }
-+ { NULL, NULL, NULL, 0, false }
- };
diff --git a/app-arch/tar/files/tar.1 b/app-arch/tar/files/tar.1
deleted file mode 100644
index 42fd22f..0000000
--- a/app-arch/tar/files/tar.1
+++ /dev/null
@@ -1,816 +0,0 @@
-.TH TAR 1 "Mar 2010" "GNU" "tar"
-.SH NAME
-tar \- The GNU version of the tape archiver (tar) utility
-.SH SYNOPSIS
-.B tar
-.I <operation> [options]
-
-.I Operations:
-.nf
-.B [-]A --catenate --concatenate
-.B [-]c --create
-.B [-]d --diff --compare
-.B [-]r --append
-.B [-]t --list
-.B [-]u --update
-.B [-]x --extract --get
-.B --delete
-.fi
-
-.I Common Options:
-.nf
-.BR -C ", " --directory " DIR"
-.BR -f ", " --file " FILE"
-.BR -j ", " --bzip2
-.BR -J ", " --xz
-.BR -p ", " --preserve-permissions
-.BR -v ", " --verbose
-.BR -z ", " --gzip
-.fi
-
-.I All Options:
-.br
-[
-.BR -a ", " --auto-compress
-]
-[
-.BR --add-file " FILE"
-]
-[
-.BR --anchored
-]
-[
-.BR --atime-preserve
-]
-[
-.BR -b ", " --blocking-factor " N"
-]
-[
-.BR -B ", " --read-full-records
-]
-[
-.BR --backup " BACKUP-TYPE"
-]
-[
-.BR --block-compress
-]
-[
-.BR -C ", " --directory " DIR"
-]
-[
-.BR --checkpoint
-]
-[
-.BR --delay-directory-restore
-]
-[
-.BR --exclude " PATTERN"
-]
-[
-.BR --exclude-caches
-]
-[
-.BR --exclude-caches-all
-]
-[
-.BR --exclude-caches-under
-]
-[
-.BR --exclude-tag " FILE"
-]
-[
-.BR --exclude-tag-all " FILE"
-]
-[
-.BR --exclude-tag-under " FILE"
-]
-[
-.BR -f ", " --file " [HOSTNAME:]FILE"
-]
-[
-.BR -F ", " --info-script " FILE, " --new-volume-script " FILE"
-]
-[
-.BR --force-local
-]
-[
-.BR --format " FORMAT"
-]
-[
-.BR -g ", " --listed-incremental " SNAPSHOT"
-]
-[
-.BR -G ", " --incremental
-]
-[
-.BR --group " GROUP"
-]
-[
-.BR -h ", " --dereference
-]
-[
-.BR --help
-]
-[
-.BR -i ", " --ignore-zeros
-]
-[
-.BR -I ", " --use-compress-program " PROG"
-]
-[
-.BR --ignore-case
-]
-[
-.BR --ignore-command-error
-]
-[
-.BR --ignore-failed-read
-]
-[
-.BR --index-file " FILE"
-]
-[
-.BR -j ", " --bzip2
-]
-[
-.BR -J ", " --xz
-]
-[
-.BR -k ", " --keep-old-files
-]
-[
-.BR -K ", " --starting-file " FILE"
-]
-[
-.BR --keep-newer-files
-]
-[
-.BR -l ", " --check-links
-]
-[
-.BR -L ", " --tape-length " N"
-]
-[
-.BR --lzip
-]
-[
-.BR --lzma
-]
-[
-.BR --lzop
-]
-[
-.BR -m ", " --touch ", " --modification-time
-]
-[
-.BR -M ", " --multi-volume
-]
-[
-.BR --mode " PERMISSIONS"
-]
-[
-.BR --mtime " DATE"
-]
-[
-.BR -N ", " --after-date " DATE, " --newer " DATE"
-]
-[
-.BR --newer-mtime " DATE"
-]
-[
-.BR --no-anchored
-]
-[
-.BR --no-auto-compress
-]
-[
-.BR --no-delay-directory-restore
-]
-[
-.BR --no-ignore-case
-]
-[
-.BR --no-ignore-command-error
-]
-[
-.BR --no-overwrite-dir
-]
-[
-.BR --no-quote-chars
-]
-[
-.BR --no-recursion
-]
-[
-.BR --no-same-permissions
-]
-[
-.BR --no-unquote
-]
-[
-.BR --no-wildcards
-]
-[
-.BR --no-wildcards-match-slash
-]
-[
-.BR --null
-]
-[
-.BR --numeric-owner
-]
-[
-.BR -o ", " --old-archive ", " --portability ", " --no-same-owner
-]
-[
-.BR -O ", " --to-stdout
-]
-[
-.BR --occurrence " NUM"
-]
-[
-.BR --one-file-system
-]
-[
-.BR --overwrite
-]
-[
-.BR --overwrite-dir
-]
-[
-.BR --owner " USER"
-]
-[
-.BR -p ", " --same-permissions ", " --preserve-permissions
-]
-[
-.BR -P ", " --absolute-names
-]
-[
-.BR --pax-option " KEYWORD-LIST"
-]
-[
-.BR --posix
-]
-[
-.BR --preserve
-]
-[
-.BR --quote-chars " STRING"
-]
-[
-.BR --quote-style " STYLE"
-]
-[
-.BR -R ", " --block-number
-]
-[
-.BR --record-size " SIZE"
-]
-[
-.BR --recursion
-]
-[
-.BR --recursive-unlink
-]
-[
-.BR --remove-files
-]
-[
-.BR --restrict
-]
-[
-.BR --rmt-command " CMD"
-]
-[
-.BR --rsh-command " CMD"
-]
-[
-.BR -s ", " --same-order ", " --preserve-order
-]
-[
-.BR -S ", " --sparse
-]
-[
-.BR --same-owner
-]
-[
-.BR --show-defaults
-]
-[
-.BR --show-omitted-dirs
-]
-[
-.BR --show-transformed-names ", " --show-stored-names
-]
-[
-.BR --strip-components " NUMBER"
-]
-[
-.BR --suffix " SUFFIX"
-]
-[
-.BR -T ", " --files-from " FILE"
-]
-[
-.BR --test-label
-]
-[
-.BR --to-command " COMMAND"
-]
-[
-.BR --transform " EXPRESSION"
-]
-[
-.BR --totals
-]
-[
-.BR -U ", " --unlink-first
-]
-[
-.BR --unquote
-]
-[
-.BR --utc
-]
-[
-.BR -v ", " --verbose
-]
-[
-.BR -V ", " --label " NAME"
-]
-[
-.BR --version
-]
-[
-.BR --volno-file " FILE"
-]
-[
-.BR -w ", " --interactive ", " --confirmation
-]
-[
-.BR -W ", " --verify
-]
-[
-.BR --wildcards
-]
-[
-.BR --wildcards-match-slash
-]
-[
-.BR -X ", " --exclude-from " FILE"
-]
-[
-.BR -z ", " --gzip ", " --gunzip ", " --ungzip
-]
-[
-.BR -Z ", " --compress ", " --uncompress
-]
-[
-.BR -[0-7][lmh]
-]
-.SH DESCRIPTION
-This manual page documents the GNU version of \fBtar\fR, an archiving
-program designed to store and extract files from an archive file known
-as a \fItarfile\fR. A \fItarfile\fR may be made on a tape drive,
-however, it is also common to write a \fItarfile\fR to a normal file.
-The first argument to \fBtar\fR must be one of the options \fBAcdrtux\fR,
-followed by any optional functions. The final arguments to \fBtar\fR
-are the names of the files or directories which should be archived. The
-use of a directory name always implies that the subdirectories below
-should be included in the archive.
-.SH EXAMPLES
-.TP
-.B tar -xvf foo.tar
-verbosely extract foo.tar
-.TP
-.B tar -xzf foo.tar.gz
-extract gzipped foo.tar.gz
-.TP
-.B tar -cjf foo.tar.bz2 bar/
-create bzipped tar archive of the directory bar called foo.tar.bz2
-.TP
-.B tar -xjf foo.tar.bz2 -C bar/
-extract bzipped foo.tar.bz2 after changing directory to bar
-.TP
-.B tar -xzf foo.tar.gz blah.txt
-extract the file blah.txt from foo.tar.gz
-.P
-Note: When working with archives, specifying the compression option is often
-times unnecessary as \fBtar\fR will automatically detect the compression type
-based on the suffix of the archive.
-.SH "FUNCTION LETTERS"
-.TP
-.B One of the following options must be used:
-.TP
-.BR -A ", " --catenate ", " --concatenate
-append tar files to an archive
-.TP
-.BR -c ", " --create
-create a new archive
-.TP
-.BR -d ", " --diff ", " --compare
-find differences between archive and file system
-.TP
-.BR -r ", " --append
-append files to the end of an archive
-.TP
-.BR -t ", " --list
-list the contents of an archive
-.TP
-.BR -u ", " --update
-only append files that are newer than the existing in archive
-.TP
-.BR -x ", " --extract ", " --get
-extract files from an archive
-.TP
-.BR --delete
-delete from the archive (not for use on magnetic tapes!)
-.SH "COMMON OPTIONS"
-.TP
-.BR -C ", " --directory " DIR"
-change to directory DIR
-.TP
-.BR -f ", " --file " [HOSTNAME:]FILE"
-use archive file or device FILE (default is "-", meaning stdin/stdout)
-.TP
-.BR -j ", " --bzip2
-filter archive through bzip2; use to decompress .bz2 files
-.TP
-.BR -J ", " --xz
-filter archive through xz; use to decompress .xz files
-.TP
-.BR -p ", " --preserve-permissions
-extract all protection information
-.TP
-.BR -v ", " --verbose
-verbosely list files processed
-.TP
-.BR -z ", " --gzip ", " --ungzip
-filter the archive through gzip
-.SH "ALL OPTIONS"
-.TP
-.BR -a ", " --auto-compress
-use archive suffix to determine the compression program
-.TP
-.BR --add-file " FILE"
-add specified FILE to the archive (useful if FILE starts with a dash)
-.TP
-.BR --anchored
-patterns will match the start of file names
-.TP
-.BR --atime-preserve
-don't change access times of files that are archived
-.TP
-.BR -b ", " --blocking-factor " N"
-block size of Nx512 bytes (default N=20)
-.TP
-.BR -B ", " --read-full-blocks
-reblock as we read (for reading 4.2BSD pipes)
-.TP
-.BR --backup " BACKUP-TYPE"
-backup files instead of deleting them using BACKUP-TYPE simple or
-numbered
-.TP
-.BR --block-compress
-block the output of compression program for tapes
-.TP
-.BR -C ", " --directory " DIR"
-change to directory DIR
-.TP
-.BR --checkpoint
-print directory names while reading the archive
-.TP
-.BR --delay-directory-restore
-delay setting modification times and permissions of extracted directories
-until the end of extraction
-.TP
-.BR --exclude " PATTERN"
-exclude files based upon PATTERN
-.TP
-.BR --exclude-caches
-exclude directories that contain a cache directory tag
-.TP
-.BR --exclude-tag " FILE"
-exclude directories that contain a file named FILE
-.TP
-.BR -f ", " --file " [HOSTNAME:]FILE"
-use archive file or device FILE (default "-", meaning stdin/stdout)
-.TP
-.BR -F ", " --info-script " FILE, " --new-volume-script " FILE"
-run script at end of each tape (implies \fI--multi-volume\fR)
-.TP
-.BR --force-local
-archive file is local even if its name contains a colon
-.TP
-.BR --format " FORMAT"
-selects the format of the created archive
-.nf
-\fIv7\fR - Unix V7
-\fIoldgnu\fR - GNU tar <=1.12
-\fIgnu\fR - GNU tar 1.13
-\fIustar\fR - POSIX.1-1988
-\fIposix\fR - POSIX.1-2001
-.fi
-.TP
-.BR -g ", " --listed-incremental " SNAPSHOT"
-create/list/extract new GNU-format incremental backup
-.TP
-.BR --group " GROUP"
-give files added to the archive a group id of GROUP instead of the group id
-of the source file; this option does not affect extraction
-.TP
-.BR -G ", " --incremental
-create/list/extract old GNU-format incremental backup
-.TP
-.BR -h ", " --dereference
-don't archive symlinks; archive the files they point to
-.TP
-.BR --help
-like this manpage, but not as cool
-.TP
-.BR -i ", " --ignore-zeros
-ignore blocks of zeros in archive (normally mean EOF)
-.TP
-.BR -I ", " --use-compress-program " PROG"
-access the archive through PROG (which is generally a compression program;
-it must accept the \fI-d\fR option)
-.TP
-.BR --ignore-case
-ignore case when excluding files
-.TP
-.BR --ignore-command-error
-ignore exit codes of subprocesses
-.TP
-.BR --ignore-failed-read
-don't exit with non-zero status on unreadable files
-.TP
-.BR --index-file " FILE"
-send verbose output to FILE instead of stdout
-.TP
-.BR -j ", " --bzip2
-filter archive through bzip2, use to decompress .bz2 files
-.TP
-.BR -J ", " --xz
-filter archive through xz; use to decompress .xz files
-.TP
-.BR -k ", " --keep-old-files
-keep existing files; don't overwrite them from archive
-.TP
-.BR -K ", " --starting-file " FILE"
-begin at file FILE in the archive
-.TP
-.BR --keep-newer-files
-do not overwrite files which are newer than the archive
-.TP
-.BR -l ", " --check-links
-warn if number of hard links to the file on the filesystem mismatchs
-the number of links recorded in the archive
-.TP
-.BR -L ", " --tape-length " N"
-change tapes after writing N*1024 bytes
-.TP
-.BR -m ", " --touch ", " --modification-time
-don't extract file modified time
-.TP
-.BR -M ", " --multi-volume
-create/list/extract multi-volume archive
-.TP
-.BR --mode " PERMISSIONS"
-apply PERMISSIONS while adding files (see \fBchmod\fR(1))
-.TP
-.BR --mtime " DATE"
-when creating archives, use DATE as the modification time of the members,
-instead of their actual modification times
-.TP
-.BR -N ", " --after-date " DATE, " --newer " DATE"
-only store files that were modified or had status updates (permissions,
-ACLs, extended attributes, ...) since DATE
-.TP
-.BR --newer-mtime " DATE"
-like \fI--newer\fR, but only store files that were modified since DATE
-.TP
-.BR --no-anchored
-match any subsequenceof the name's components with \fI--exclude\fR
-.TP
-.BR --no-auto-compress
-do not use archive suffix to determine the compression program
-.TP
-.BR --no-delay-directory-restore
-modification times and permissions of extracted directories are set when
-all files from this directory have been extracted; this is the default
-.TP
-.BR --no-ignore-command-error
-print warnings about subprocesses that terminated with a non-zero exit code
-.TP
-.BR --no-ignore-case
-use case-sensitive matching with \fI--exclude\fR
-.TP
-.BR --no-overwrite-dir
-preserve metadata of existing directories when extracting files from an
-archive
-.TP
-.BR --no-quote-chars " STRING"
-remove characters listed in STRING from the list of quoted characters
-set by a previous \fI--quote-chars\fR option
-.TP
-.BR --no-recursion
-don't recurse into directories
-.TP
-.BR --no-same-permissions
-apply user's umask when extracting files instead of recorded permissions
-.TP
-.BR --no-unquote
-treat all input file or member names literally, do not interpret
-escape sequences
-.TP
-.BR --no-wildcards
-don't use wildcards with \fI--exclude\fR
-.TP
-.BR --no-wildcards-match-slash
-wildcards do not match slashes (/) with \fI--exclude\fR
-.TP
-.BR --null
-\fI--files-from\fR reads null-terminated names, disable \fI--directory\fR
-.TP
-.BR --numeric-owner
-always use numbers for user/group names
-.TP
-.BR -o ", " --old-archive ", " --portability
-like \fI--format=v7\fR; \fI-o\fR exhibits this behavior when creating an
-archive (deprecated behavior)
-.TP
-.BR -o ", " --no-same-owner
-do not attempt to restore ownership when extracting; \fI-o\fR exhibits
-this behavior when extracting an archive
-.TP
-.BR -O ", " --to-stdout
-extract files to standard output
-.TP
-.BR --occurrence " NUM"
-process only NUM occurrences of each named file; used with
-\fI--delete\fR, \fI--diff\fR, \fI--extract\fR, or \fI--list\fR
-.TP
-.BR --one-file-system
-stay in local file system when creating an archive
-.TP
-.BR --one-file-system
-stay in local file system when creating an archive
-.TP
-.BR --overwrite
-overwrite existing files and directory metadata when extracting
-.TP
-.BR --overwrite-dir
-overwrite directory metadata when extracting
-.TP
-.BR --owner " USER"
-give files added to the archive a user id of USER instead of the user id
-of the source file; this option does not affect extraction
-.TP
-.BR -p ", " --preserve-permissions ", " --same-permissions
-extract all protection information
-.TP
-.BR -P ", " --absolute-names
-don't strip leading `/'s from file names
-.TP
-.BR --pax-option " KEYWORD-LIST"
-used only with POSIX.1-2001 archives to modify the way \fBtar\fR handles
-extended header keywords
-.TP
-.BR --posix
-like \fI--format=posix\fR
-.TP
-.BR --preserve
-like \fI--preserve-permissions\fR plus \fI--same-order\fR
-.TP
-.BR --quote-chars " STRING"
-always quote the characters from STRING, even if the selected quoting
-style would not quote them
-.TP
-.BR --quote-style " STYLE"
-set the quoting style to be used when printing member and file names
-.TP
-.BR -R ", " --record-number
-show record number within archive with each message
-.TP
-.BR --record-size " SIZE"
-use SIZE bytes per record when accessing archives
-.TP
-.BR --recursion
-recurse into directories
-.TP
-.BR --recursive-unlink
-remove existing directories before extracting directories of the same name
-.TP
-.BR --remove-files
-remove files after adding them to the archive
-.TP
-.BR --restrict
-disable the use of some potentially harmful options; currently this
-disables shell invocation from the multi-volume menu
-.TP
-.BR --rmt-command " CMD"
-use CMD instead of the default /usr/sbin/rmt
-.TP
-.BR --rsh-command " CMD"
-use remote CMD instead of \fBrsh\fR(1)
-.TP
-.BR -s ", " --same-order ", " --preserve-order
-list of names to extract is sorted to match archive
-.TP
-.BR -S ", " --sparse
-handle sparse files efficiently
-.TP
-.BR --same-owner
-create extracted files with the same ownership
-.TP
-.BR --show-defaults
-display the default options used by \fBtar\fR
-.TP
-.BR --show-omitted-dirs
-print directories \fBtar\fR skips while operating on an archive
-.TP
-.BR --show-transformed-names ", " --show-stored-names
-display file or member names after applying any \fBsed\fR transformations
-.TP
-.BR --strip-components " NUMBER"
-strip NUMBER of leading path components from file names before extraction
-.TP
-.BR --suffix " SUFFIX"
-use SUFFIX instead of default '~' when backing up files
-.TP
-.BR -T ", " --files-from " FILE"
-get names to extract or create from file FILE
-.TP
-.BR --test-label
-read the volume label; if an argument is specified, test whether it
-matches the volume label
-.TP
-.BR --to-command " COMMAND"
-during extraction, pipe extracted files to the standard input of COMMAND
-.TP
-.BR --totals
-print total bytes written with --create
-.TP
-.BR --transform " EXPRESSION"
-transform file or member names using the \fBsed\fR replacement expression
-EXPRESSION
-.TP
-.BR -U ", " --unlink-first
-remove existing files before extracting files of the same name
-.TP
-.BR --unquote
-enable unquoting input file or member names; this is the default
-.TP
-.BR --utc
-display file modification dates in UTC
-.TP
-.BR -v ", " --verbose
-verbosely list files processed
-.TP
-.BR -V ", " --label " NAME"
-create archive with volume name NAME
-.TP
-.BR --version
-print \fBtar\fR program version number
-.TP
-.BR --volno-file " FILE"
-keep track of which volume of a multi-volume archive its working in
-FILE; used with \fI--multi-volume\fR
-.TP
-.BR -w ", " --interactive ", " --confirmation
-ask for confirmation for every action
-.TP
-.BR -W ", " --verify
-attempt to verify the archive after writing it
-.TP
-.BR --wildcards
-use wildcards with \fI--exclude\fR
-.TP
-.BR --wildcards-match-slash
-wildcards match slashes (/) with \fI--exclude\fR
-.TP
-.BR -X ", " --exclude-from " FILE"
-exclude files listed in FILE
-.TP
-.BR -z ", " --gzip ", " --gunzip ", " --ungzip
-filter the archive through gzip
-.TP
-.BR -Z ", " --compress ", " --uncompress
-filter the archive through compress
-.TP
-.BR -[0-7][lmh]
-specify drive and density
-.SH BUGS
-The GNU folks, in general, abhor man pages and create info documents instead.
-The maintainer of \fBtar\fR falls into this category. Thus, this man page may
-not be complete nor current, and it is included in the Gentoo portage tree
-because man is a great tool :). This man page was first taken from Debian
-Linux and has since been lovingly updated here.
-.SH "REPORTING BUGS"
-Please report bugs via http://bugs.gentoo.org/
-.SH "AUTHORS"
-.nf
-Debian Linux http://www.debian.org/
-Mike Frysinger <vapier@gentoo.org>
-.fi
diff --git a/app-arch/tar/metadata.xml b/app-arch/tar/metadata.xml
deleted file mode 100644
index 96a2d58..0000000
--- a/app-arch/tar/metadata.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
-<pkgmetadata>
-<herd>base-system</herd>
-</pkgmetadata>
diff --git a/app-arch/tar/tar-1.26-r3.ebuild b/app-arch/tar/tar-1.26-r3.ebuild
deleted file mode 100644
index 5429d6f..0000000
--- a/app-arch/tar/tar-1.26-r3.ebuild
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-arch/tar/tar-1.26.ebuild,v 1.1 2011/03/13 20:46:42 vapier Exp $
-
-EAPI="3"
-
-inherit autotools flag-o-matic
-
-DESCRIPTION="Use this to make tarballs :)"
-HOMEPAGE="http://www.gnu.org/software/tar/"
-SRC_URI="mirror://gnu/tar/${P}.tar.bz2"
-
-LICENSE="GPL-3"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="nls static userland_GNU acl caps selinux xattr"
-
-RDEPEND=""
-DEPEND="${RDEPEND}
- nls? ( >=sys-devel/gettext-0.10.35 )"
-
-src_prepare() {
- epatch "${FILESDIR}"/${P}-full-xattr.patch #382067
- eautoreconf
-
- if ! use userland_GNU ; then
- sed -i \
- -e 's:/backup\.sh:/gbackup.sh:' \
- scripts/{backup,dump-remind,restore}.in \
- || die "sed non-GNU"
- fi
-}
-
-src_configure() {
- local myconf
- use static && append-ldflags -static
- use userland_GNU || myconf="--program-prefix=g"
- if use acl || use caps || use selinux || use xattr ; then
- myconf+=" --enable-xattr"
- fi
- # Work around bug in sandbox #67051
- gl_cv_func_chown_follows_symlink=yes \
- FORCE_UNSAFE_CONFIGURE=1 \
- econf \
- --enable-backup-scripts \
- --bindir="${EPREFIX}"/bin \
- --libexecdir="${EPREFIX}"/usr/sbin \
- $(use_enable nls) \
- ${myconf}
-}
-
-src_install() {
- local p=""
- use userland_GNU || p=g
-
- emake DESTDIR="${D}" install || die
-
- if [[ -z ${p} ]] ; then
- # a nasty yet required piece of baggage
- exeinto /etc
- doexe "${FILESDIR}"/rmt || die
- fi
-
- # autoconf looks for gtar before tar (in configure scripts), hence
- # in Prefix it is important that it is there, otherwise, a gtar from
- # the host system (FreeBSD, Solaris, Darwin) will be found instead
- # of the Prefix provided (GNU) tar
- if use prefix ; then
- dosym tar /bin/gtar
- fi
-
- dodoc AUTHORS ChangeLog* NEWS README* THANKS
- newman "${FILESDIR}"/tar.1 ${p}tar.1
- mv "${ED}"/usr/sbin/${p}backup{,-tar}
- mv "${ED}"/usr/sbin/${p}restore{,-tar}
-}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-09 23:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-24 20:21 [gentoo-commits] dev/blueness:master commit in: app-arch/tar/files/, app-arch/tar/ Anthony G. Basile
-- strict thread matches above, loose matches on Subject: below --
2013-05-09 23:33 Anthony G. Basile
2011-09-24 17:33 Anthony G. Basile
2011-09-10 14:12 Anthony G. Basile
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox