>From 07e1634b93f8e41c6ab80f53067cea87a25353e6 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Thu, 2 Jun 2016 08:00:10 +0200 Subject: [PATCH 2/2] * tests/xattr06.at: Test include/exclude during archive/exctract. --- src/xattrs.c | 2 +- tests/xattr06.at | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/xattrs.c b/src/xattrs.c index 655dd43..d9f1f8b 100644 --- a/src/xattrs.c +++ b/src/xattrs.c @@ -495,7 +495,7 @@ xattrs_xattrs_get (int parentfd, char const *file_name, if (aret != -1) { - if (!xattrs_masked_out(attr, true)) + if (!xattrs_masked_out (attr, true)) xheader_xattr_add (st, attr, val, aret); } else if (errno != ENOATTR) diff --git a/tests/xattr06.at b/tests/xattr06.at index 42204af..691f7e7 100644 --- a/tests/xattr06.at +++ b/tests/xattr06.at @@ -34,16 +34,21 @@ mkdir dir mkdir output genfile --file dir/file -setfattr -n user.excludedxattr -v value dir/file +for attr in excluded incla inclb inclc incl_excluded +do + setfattr -n user.${attr} -v value dir/file || AT_SKIP_TEST +done -# exclude the attribute we just set -tar --xattrs --xattrs-exclude=user.excludedxattr -cf archive.tar -C dir . +tar --xattrs-include=user.incl'*' --xattrs-exclude=user.incl_excluded -cf archive.tar -C dir . +tar -xf archive.tar --xattrs-include=user.incl[[ab]] --xattrs-exclude=user.inclb -C output -tar --xattrs -xf archive.tar -C output -getfattr -d output/file | grep -v excludedxattr > without -getfattr -d output/file > with +getfattr -d output/file | grep -v \ + -e excluded \ + -e inclb \ + -e inclc > filtered +getfattr -d output/file > full # if they differ then the attribute is still present -diff without with +diff filtered full ], [0], []) -- 2.5.5