fs/tar: add support for xattrs (thus capabilties)
authorYann E. MORIN <yann.morin.1998@free.fr>
Mon, 12 Nov 2018 17:33:12 +0000 (18:33 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Tue, 20 Nov 2018 22:28:07 +0000 (23:28 +0100)
By default, tar will not include any extended attribute (xattr) when
creating archives, and thus will not store capabilties either (as they
are stored in the xattr 'security.capability').

Using option --xattrs is enough to create a tarball with all the xattrs
attached to a file. However, extracting all xattrs from a tarball
requires that --xattrs-include='*' be used. This is not symetric (but on
purpose, as per the documentation), and so is confusing to some.

So, we use --xattrs-include='*' to create the archive, so as to be
explicit that we want all xattrs to be stored.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
fs/tar/tar.mk

index 68149e9eb748ce121dcee382204cc5b5d8a0c6d4..4c6327ace8b0aeebadac0101bb6cc977d57f9206 100644 (file)
@@ -10,7 +10,7 @@ ROOTFS_TAR_DEPENDENCIES = $(BR2_TAR_HOST_DEPENDENCY)
 
 define ROOTFS_TAR_CMD
        (cd $(TARGET_DIR); find -print0 | LC_ALL=C sort -z | \
-               tar $(TAR_OPTS) -cf $@ --null --no-recursion -T - --numeric-owner)
+               tar $(TAR_OPTS) -cf $@ --null --xattrs-include='*' --no-recursion -T - --numeric-owner)
 endef
 
 $(eval $(rootfs))