]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
* tests/xattr06.at: Test include/exclude during archive/exctract.
authorPavel Raiskup <praiskup@redhat.com>
Thu, 2 Jun 2016 06:00:10 +0000 (08:00 +0200)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 10 Nov 2016 08:02:44 +0000 (10:02 +0200)
src/xattrs.c
tests/xattr06.at

index 655dd437ebac763884d2f9a4396eec1c19032561..d9f1f8bfc0420aae7287d060d88f51577a6f831e 100644 (file)
@@ -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)
index 42204afdb156c1233b34d2cc2100a01e3a540c95..691f7e7069e30be61f59c487660e82cdb27cd193 100644 (file)
@@ -34,16 +34,21 @@ mkdir dir
 mkdir output
 genfile --file dir/file
 
-setfattr -n user.excludedxattr -v value dir/file
-
-# exclude the attribute we just set
-tar --xattrs --xattrs-exclude=user.excludedxattr -cf archive.tar -C dir .
-
-tar --xattrs -xf archive.tar -C output
-getfattr -d output/file | grep -v excludedxattr > without
-getfattr -d output/file > with
+for attr in excluded incla inclb inclc incl_excluded
+do
+  setfattr -n user.${attr} -v value dir/file || AT_SKIP_TEST
+done
+
+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
+
+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],
 [])