f4af7d
diff --git a/doc/tar.texi b/doc/tar.texi
f4af7d
index d678db9..ab8a0c8 100644
f4af7d
--- a/doc/tar.texi
f4af7d
+++ b/doc/tar.texi
f4af7d
@@ -37,7 +37,8 @@ This manual is for @acronym{GNU} @command{tar} (version
f4af7d
 from archives.
f4af7d
 
f4af7d
 Copyright @copyright{} 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
f4af7d
-2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
f4af7d
+2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
f4af7d
+Foundation, Inc.
f4af7d
 
f4af7d
 @quotation
f4af7d
 Permission is granted to copy, distribute and/or modify this document
f4af7d
@@ -162,6 +163,7 @@ How to Create Archives
f4af7d
 How to List Archives
f4af7d
 
f4af7d
 * list dir::
f4af7d
+* List Extended Attributes::
f4af7d
 
f4af7d
 How to Extract Members from an Archive
f4af7d
 
f4af7d
@@ -1492,6 +1494,7 @@ for a detailed discussion of globbing patterns and related
f4af7d
 
f4af7d
 @menu
f4af7d
 * list dir::
f4af7d
+* List Extended Attributes::
f4af7d
 @end menu
f4af7d
 
f4af7d
 @node list dir
f4af7d
@@ -1522,6 +1525,116 @@ drwxrwxrwx myself/user       0 1990-05-31 21:49 practice/
f4af7d
 When you use a directory name as a file name argument, @command{tar} acts on
f4af7d
 all the files (including sub-directories) in that directory.
f4af7d
 
f4af7d
+@node List Extended Attributes
f4af7d
+@unnumberedsubsec Listing xattrs, POSIX ACLs and SELinux context
f4af7d
+
f4af7d
+From upstream GNU tar 1.26.9, tar is able to store, extract and list extended
f4af7d
+file attributes.  Listing of those attributes is then active only in verbose and
f4af7d
+double-verbose mode.
f4af7d
+
f4af7d
+This section exercises how to list attributes on examples.  Lets start with
f4af7d
+simple verbose mode.  This output is inspired by GNU @command{ls -l} command
f4af7d
+output.
f4af7d
+
f4af7d
+@itemize @bullet
f4af7d
+@item
f4af7d
+Show only pure extended attributes.
f4af7d
+
f4af7d
+@smallexample
f4af7d
+$ tar --xattrs --list -v archive.tar
f4af7d
+-rw-rwxr--  user/group 0 2012-08-08 15:15 acls.txt
f4af7d
+-rw-rw-r--* user/group 0 2012-08-08 15:15 xattrs.txt
f4af7d
+@end smallexample
f4af7d
+
f4af7d
+Note the asterisk on the third line!  It reflects the situation that the file
f4af7d
+'xattrs.txt' has some extended attribute set.  The default mode (same as if you
f4af7d
+are extracting extended attributes) shows information only about extended
f4af7d
+attributes from 'user.*' domain.  Anyway, feel free to change the sensitivity
f4af7d
+using @option{--xattrs-include} or @option{--xattrs-exclude} options.
f4af7d
+
f4af7d
+@item Show only POSIX ACLs - the character you should look for is '+':
f4af7d
+
f4af7d
+@smallexample
f4af7d
+$ tar --acls --list -v archive.tar
f4af7d
+-rw-rwxr--+ praiskup/praiskup 0 2012-08-08 15:15 acls.txt
f4af7d
+-rw-rw-r--  praiskup/praiskup 0 2012-08-08 15:15 xattrs.txt
f4af7d
+@end smallexample
f4af7d
+
f4af7d
+@item Show only SELinux - the key character is '.':
f4af7d
+
f4af7d
+@smallexample
f4af7d
+$ tar --selinux --list -v archive.tar
f4af7d
+-rw-rw-r--.  praiskup/praiskup 0 2012-08-08 15:16 selinux_only.txt
f4af7d
+-rw-rw-r--   praiskup/praiskup 0 2012-08-08 15:15 xattrs.txt
f4af7d
+@end smallexample
f4af7d
+
f4af7d
+@item
f4af7d
+Show info about ACLs, SELinux and general extended attributes together:
f4af7d
+
f4af7d
+@smallexample
f4af7d
+$ tar --selinux --acls --xattrs --list -v archive.tar
f4af7d
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:16 selinux_only.txt
f4af7d
+-rw-rwxr--+ praiskup/praiskup 0 2012-08-08 15:15 acls.txt
f4af7d
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:15 xattrs.txt
f4af7d
+@end smallexample
f4af7d
+
f4af7d
+In this case, the priority of character is '+' > '.' > '*'.  You don't see the
f4af7d
+general extended attributes flag ('*' character) on this example because it is
f4af7d
+hidden by '.' (meaning that the file has SELinux context set).
f4af7d
+
f4af7d
+@end itemize
f4af7d
+
f4af7d
+The example of double verbose mode is here.  In this output the single verbose
f4af7d
+characters '.', '+' and '*' are also present after the permission string.
f4af7d
+
f4af7d
+@smallexample
f4af7d
+$ tar --xattrs --selinux --acls -tvvf archive.tar
f4af7d
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:16 selinux_only.txt
f4af7d
+  s: unconfined_u:object_r:user_tmp_t:s0
f4af7d
+-rw-rwxr--+ praiskup/praiskup 0 2012-08-08 15:15 acls.txt
f4af7d
+  s: unconfined_u:object_r:user_tmp_t:s0
f4af7d
+  a: user::rw-,user:tester:rwx,group::rw-,mask::rwx,other::r--
f4af7d
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:15 xattrs.txt
f4af7d
+  s: unconfined_u:object_r:user_tmp_t:s0
f4af7d
+  x: 12 user.xattr
f4af7d
+  x: 12 user.we_like_tar
f4af7d
+@end smallexample
f4af7d
+
f4af7d
+This mode extends tar's output with additional lines beginning with
f4af7d
+distinguishing characters - 's' for SELinux context, 'a' for POSIX Access
f4af7d
+Control Lists  and 'x' for generic extended attributes.
f4af7d
+
f4af7d
+In this format, POSIX ACLs are written in SHORT TEXT FORM as specified in manual
f4af7d
+page @command{man 5 acl}.
f4af7d
+
f4af7d
+Use the @option{--xattrs-include} again if you want to print other than default
f4af7d
+'user.*' extended attributes domain:
f4af7d
+
f4af7d
+@smallexample
f4af7d
+$ tar --xattrs --xattrs-include='*' --acls --selinux -tvvf archive.tar
f4af7d
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:16 selinux_only.txt
f4af7d
+  s: unconfined_u:object_r:user_tmp_t:s0
f4af7d
+  x: 36 security.selinux
f4af7d
+-rw-rwxr--+ praiskup/praiskup 0 2012-08-08 15:15 acls.txt
f4af7d
+  s: unconfined_u:object_r:user_tmp_t:s0
f4af7d
+  a: user::rw-,user:tester:rwx,group::rw-,mask::rwx,other::r--
f4af7d
+  x: 36 security.selinux
f4af7d
+  x: 44 system.posix_acl_access
f4af7d
+-rw-rw-r--. praiskup/praiskup 0 2012-08-08 15:15 xattrs.txt
f4af7d
+  s: unconfined_u:object_r:user_tmp_t:s0
f4af7d
+  x: 36 security.selinux
f4af7d
+  x: 12 user.xattr
f4af7d
+  x: 12 user.we_like_tar
f4af7d
+@end smallexample
f4af7d
+
f4af7d
+As is in @pxref{Option Summary} section described, tar by default stores all
f4af7d
+extended attributes that are available (not only 'user.*' domain).  It means
f4af7d
+that the SELinux context and POSIX ACLs (because they are implemented using the
f4af7d
+generic extended attributes on usual file system) may be stored twice sometimes
f4af7d
+-- firstly in "raw" file system binary format and secondly in more portable way
f4af7d
+-- using appropriate system calls (invoked by @command{tar} options
f4af7d
+@option{--selinux} and @option{--acls}).
f4af7d
+
f4af7d
 @node extract
f4af7d
 @section How to Extract Members from an Archive
f4af7d
 @cindex Extraction
f4af7d
@@ -2371,6 +2484,10 @@ Normally when creating an archive, @command{tar} strips an initial
f4af7d
 @samp{/} from member names.  This option disables that behavior.
f4af7d
 @xref{absolute}.
f4af7d
 
f4af7d
+@opsummary{acls}
f4af7d
+@item --acls
f4af7d
+Causes @command{tar} to store/restore/list POSIX ACL's.  @xref{Attributes}.
f4af7d
+
f4af7d
 @opsummary{after-date}
f4af7d
 @item --after-date
f4af7d
 
f4af7d
@@ -2919,6 +3036,11 @@ contents have changed (as opposed to just @option{--newer}, which will
f4af7d
 also back up files for which any status information has
f4af7d
 changed).  @xref{after}.
f4af7d
 
f4af7d
+@opsummary{no-acls}
f4af7d
+@item --no-acls
f4af7d
+Causes @command{tar} not to store, extract or list POSIX ACL's.
f4af7d
+@xref{Attributes}.
f4af7d
+
f4af7d
 @opsummary{no-anchored}
f4af7d
 @item --no-anchored
f4af7d
 An exclude pattern can match any subsequence of the name's components.
f4af7d
@@ -3002,11 +3124,20 @@ locations.  Usually @command{tar} determines automatically whether
f4af7d
 the archive can be seeked or not.  Use this option to disable this
f4af7d
 mechanism.
f4af7d
 
f4af7d
+@opsummary{no-selinux}
f4af7d
+@item --no-selinux
f4af7d
+Causes @command{tar} not to store, extract or list SELinux security context.
f4af7d
+@xref{Attributes}.
f4af7d
+
f4af7d
 @opsummary{no-unquote}
f4af7d
 @item --no-unquote
f4af7d
 Treat all input file or member names literally, do not interpret
f4af7d
 escape sequences.  @xref{input name quoting}.
f4af7d
 
f4af7d
+@opsummary{no-xattrs}
f4af7d
+@item --no-xattrs
f4af7d
+Causes @command{tar} not to store, extract or list xattrs.  @xref{Attributes}.
f4af7d
+
f4af7d
 @opsummary{no-wildcards}
f4af7d
 @item --no-wildcards
f4af7d
 Do not use wildcards.
f4af7d
@@ -3239,6 +3370,11 @@ in cases when such recognition fails.  It takes effect only if the
f4af7d
 archive is open for reading (e.g. with @option{--list} or
f4af7d
 @option{--extract} options).
f4af7d
 
f4af7d
+@opsummary{selinux}
f4af7d
+@item --selinux
f4af7d
+Causes @command{tar} to store, extract or list SELinux security context.
f4af7d
+@xref{Attributes}.
f4af7d
+
f4af7d
 @opsummary{show-defaults}
f4af7d
 @item --show-defaults
f4af7d
 
f4af7d
@@ -3466,6 +3602,11 @@ Enable or disable warning messages identified by @var{keyword}.  The
f4af7d
 messages are suppressed if @var{keyword} is prefixed with @samp{no-}.
f4af7d
 @xref{warnings}.
f4af7d
 
f4af7d
+@opsummary{xattrs}
f4af7d
+@item --xattrs
f4af7d
+Causes @command{tar} to store, restore or list extended file attributes.  For
f4af7d
+more info see @xref{Attributes}.
f4af7d
+
f4af7d
 @opsummary{wildcards}
f4af7d
 @item --wildcards
f4af7d
 Use wildcards when matching member names with patterns.
f4af7d
@@ -4218,6 +4359,11 @@ tar (child): trying gzip
f4af7d
 This means that @command{tar} first tried to decompress
f4af7d
 @file{archive.Z} using @command{compress}, and, when that
f4af7d
 failed, switched to @command{gzip}.
f4af7d
+@kwindex xattr-write
f4af7d
+@item xattr-write
f4af7d
+@samp{%s: Cannot set '%s' extended attribute for file '%s'}
f4af7d
+@*@samp{%s: Cannot set POSIX ACLs for file '%s'}
f4af7d
+@*@samp{%s: Cannot set SELinux context for file '%s'}
f4af7d
 @end table
f4af7d
 
f4af7d
 @subheading Keywords controlling incremental extraction:
f4af7d
@@ -8770,6 +8916,8 @@ implementation able to read @samp{ustar} archives will be able to read
f4af7d
 most @samp{posix} archives as well, with the only exception that any
f4af7d
 additional information (such as long file names etc.) will in such
f4af7d
 case be extracted as plain text files along with the files it refers to.
f4af7d
+This is the only format that can store ACLs, SELinux context and extended
f4af7d
+attributes.
f4af7d
 
f4af7d
 This archive format will be the default format for future versions
f4af7d
 of @GNUTAR{}.
f4af7d
@@ -9412,6 +9560,135 @@ Same as both @option{--same-permissions} and @option{--same-order}.
f4af7d
 
f4af7d
 This option is deprecated, and will be removed in @GNUTAR{} version 1.23.
f4af7d
 
f4af7d
+@opindex xattrs
f4af7d
+@item --xattrs
f4af7d
+This option causes @command{tar} to store, restore or list the extended file
f4af7d
+attributes (for information about extended attributes see @command{man(5)
f4af7d
+attr}).
f4af7d
+
f4af7d
+Note that all extended attributes are stored "as-is" (in file system binary
f4af7d
+format) and the resulting archive may be not fully portable.  See the
f4af7d
+@option{--selinux} and @option{--acls} options when you want to deal with these
f4af7d
+types of extended attributes in a better way.
f4af7d
+
f4af7d
+The @option{--xattrs} option implies the option @option{--format=posix} when
f4af7d
+tar is in @option{--create} operation mode.  It is the only one format which
f4af7d
+hase usable headers for storing additional file information like extended
f4af7d
+attributes are.
f4af7d
+
f4af7d
+By default, all extended attributes are stored into the archive.  The reason is
f4af7d
+that we want to make the backup process as complete as possible by default.  On
f4af7d
+the other hand, during extracting only the 'user.*' domain is extracted by
f4af7d
+default.  Anyway, this default behaviour may be easily modified by the
f4af7d
+@option{--xattrs-include} and @option{--xattrs-exclude} options.
f4af7d
+
f4af7d
+When you list an archive in verbose mode
f4af7d
+(@command{tar --xattrs --verbose -tf archive.tar}), tar shows the '*' character
f4af7d
+after the permissions string of concrete file ringht to tell you that at least
f4af7d
+one extended attribute is stored with corresponding file.
f4af7d
+
f4af7d
+Double verbose mode (@command{tar --xattrs -tvvf archive.tar}) prints the
f4af7d
+extended attribute length (in bytes) and its ASCII key (for printed examples
f4af7d
+@pxref{List Extended Attributes}).
f4af7d
+
f4af7d
+@option{--xattrs} option has no equivalent short option.
f4af7d
+
f4af7d
+Warnings which occur during impossible writing of extended attributes to
f4af7d
+a file system may be suppressed using the @option{--warning=no-xattr-write}
f4af7d
+option.
f4af7d
+
f4af7d
+@opindex no-xattrs
f4af7d
+@item --no-xattrs
f4af7d
+This option causes @command{tar} not to store/extract or list the current
f4af7d
+extended attributes.  This option does not affect options @option{--no-selinux}
f4af7d
+or @option{--no-acls}.
f4af7d
+
f4af7d
+The @option{--no-xattrs} option has no equivalent short option name.
f4af7d
+
f4af7d
+@opindex xattrs-include
f4af7d
+@opindex xattrs-exclude
f4af7d
+@item --xattrs-include=MASK
f4af7d
+@itemx --xattrs-exclude=MASK
f4af7d
+
f4af7d
+These options allows the xattr store/restore/list process to be more fine
f4af7d
+grained.  The default configuration is that @option{--create} mode handles all
f4af7d
+available extended attributes and the @option{--extract}/@option{--list} mode
f4af7d
+handles only 'user.*' domain.  These options may be used for editing of this
f4af7d
+default behaviour.
f4af7d
+
f4af7d
+@itemize @bullet
f4af7d
+@item
f4af7d
+Lets say we want to store all attributes except some "public restricted" domain
f4af7d
+(e.g.  'user.restricted.*' domain.  The correct way how to do it is:
f4af7d
+
f4af7d
+@command{tar --xattrs --xattrs-include='*' --xattrs-exclude='user.restricted.*'
f4af7d
+-cf archive.tar FILES}
f4af7d
+@item
f4af7d
+And, when we want to extract only some specific domain from an archive - we can
f4af7d
+use:
f4af7d
+
f4af7d
+@command{tar --xattrs --xattrs-include='security.capability' -xf archive.tar
f4af7d
+FILES}
f4af7d
+@end itemize
f4af7d
+
f4af7d
+Multiple passed include/exclude patterns are combined together.  The attribute
f4af7d
+is covered then only if (1) at least one of all include patterns matches its
f4af7d
+keyword and (2) no exclude pattern matches its keyword.
f4af7d
+
f4af7d
+When only include pattern is set - exclude pattern is left in default mode (and
f4af7d
+vice versa).
f4af7d
+
f4af7d
+@opindex selinux
f4af7d
+@item --selinux
f4af7d
+This option causes @command{tar} to store/extract/list the SELinux context
f4af7d
+information into/from an archive.  Command @command{tar} is able to show info
f4af7d
+whether the SELinux context is present in archived file using the verbose
f4af7d
+listing mode (@command{tar --selinux -tvf archive.tar}).  It shows the '.'
f4af7d
+character after permission string in that case.  Double-verbose listing mode
f4af7d
+(@command{tar -tvvf archive.tar}) then prints the full SELinux context to
f4af7d
+standard output, @pxref{List Extended Attributes} for printed example.
f4af7d
+
f4af7d
+This option implies the @option{--format=posix} when @command{tar} works in
f4af7d
+@option{--create} operation mode.
f4af7d
+
f4af7d
+Warnings complaining that SELinux context may not be written to a file system
f4af7d
+may be suppressed by the @option{--warning=no-xattr-write} option.
f4af7d
+
f4af7d
+The @option{--selinux} option has no equivalent short option name.
f4af7d
+
f4af7d
+@opindex no-selinux
f4af7d
+@item --no-selinux
f4af7d
+This option causes @command{tar} not to store the current SELinux security
f4af7d
+context information in the archive and not to extract any SELinux information in
f4af7d
+an archive.
f4af7d
+
f4af7d
+The @option{--no-selinux} option has no equivalent short option name.
f4af7d
+
f4af7d
+@opindex acls
f4af7d
+@item --acls
f4af7d
+This option causes @command{tar} to store the current POSIX access control lists
f4af7d
+into the archive or restore POSIX ACLs from an archive.  It also allows
f4af7d
+@command{tar} to show whether archived file contains ACLs when the verbose mode
f4af7d
+is active (@option{tar --acls -tvf} shows the symbol '+' after the permission
f4af7d
+characters in that case).  Double-verbose mode allows @command{tar} to list
f4af7d
+contained POSIX ACLs (@command{tar --acls -tvvf archive.tar}), for printed
f4af7d
+examples @pxref{List Extended Attributes}.
f4af7d
+
f4af7d
+This option implies the @option{--format=posix} when @command{tar} works in
f4af7d
+@option{--create} operation mode.
f4af7d
+
f4af7d
+Warnings complaining that POSIX ACLs may not be written to a file system may be
f4af7d
+suppressed by the @option{--warning=no-xattr-write} option.
f4af7d
+
f4af7d
+The @option{--acls} option has no equivalent short form.
f4af7d
+
f4af7d
+@opindex no-acls
f4af7d
+@item --no-acls
f4af7d
+This option causes @command{tar} not to store the current POSIX ACL into the
f4af7d
+archive and not to extract any POSIX ACL information from an archive.
f4af7d
+
f4af7d
+The @option{--no-acls} option has no equivalent short option name.
f4af7d
+
f4af7d
 @end table
f4af7d
 
f4af7d
 @node Portability