xattr06.at 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. #
  3. # Test suite for GNU tar.
  4. # Copyright 2012-2019 Free Software Foundation, Inc.
  5. # This file is part of GNU tar.
  6. # GNU tar is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3 of the License, or
  9. # (at your option) any later version.
  10. # GNU tar is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #
  17. # Test description: Test for exclude of xattr during archive creation
  18. #
  19. # Relevant mailing list thread:
  20. #
  21. # http://lists.gnu.org/archive/html/bug-tar/2016-05/msg00031.html
  22. AT_SETUP([xattrs: exclude xattrs on create ])
  23. AT_KEYWORDS([xattrs xattr06])
  24. AT_TAR_CHECK([
  25. AT_XATTRS_PREREQ
  26. mkdir dir
  27. mkdir output
  28. genfile --file dir/file
  29. for attr in excluded incla inclb inclc incl_excluded
  30. do
  31. setfattr -n user.${attr} -v value dir/file || AT_SKIP_TEST
  32. done
  33. tar --xattrs-include=user.incl'*' --xattrs-exclude=user.incl_excluded -cf archive.tar -C dir .
  34. tar -xf archive.tar --xattrs-include=user.incl[[ab]] --xattrs-exclude=user.inclb -C output
  35. getfattr -d output/file | grep -v \
  36. -e excluded \
  37. -e inclb \
  38. -e inclc > filtered
  39. getfattr -d output/file > full
  40. # if they differ then the attribute is still present
  41. diff filtered full
  42. ],
  43. [0],
  44. [])
  45. AT_CLEANUP