capabs_raw01.at 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. #
  3. # Test suite for GNU tar.
  4. # Copyright (C) 2012 Free Software Foundation, Inc.
  5. #
  6. # This program 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, or (at your option)
  9. # any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. # Test description: Test if file capabilities are archived/restored correctly
  20. # using just the default xattr support (capabilities are stored/restored in
  21. # binary format -> system dependant).
  22. AT_SETUP([capabilities: binary store/restore])
  23. AT_KEYWORDS([xattrs capabilities capabs_raw01])
  24. AT_TAR_CHECK([
  25. AT_PRIVILEGED_PREREQ
  26. AT_XATTRS_PREREQ
  27. AT_CAPABILITIES_UTILS_PREREQ
  28. mkdir dir
  29. genfile --file dir/file
  30. setcap "= cap_chown=ei" dir/file
  31. # archive whole directory including binary xattrs
  32. tar --xattrs -cf archive.tar dir
  33. # clear the directory
  34. rm -rf dir
  35. # restore _all_ xattrs (not just the user.* domain)
  36. tar --xattrs --xattrs-include='*' -xf archive.tar
  37. getcap dir/file
  38. ],
  39. [0],
  40. [dir/file = cap_chown+ei
  41. ])
  42. AT_CLEANUP