capabs_raw01.at 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. #
  3. # Test suite for GNU tar.
  4. # Copyright 2012-2014 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 if file capabilities are archived/restored correctly
  18. # using just the default xattr support (capabilities are stored/restored in
  19. # binary format -> system dependant).
  20. AT_SETUP([capabilities: binary store/restore])
  21. AT_KEYWORDS([xattrs capabilities capabs_raw01])
  22. AT_TAR_CHECK([
  23. AT_PRIVILEGED_PREREQ
  24. AT_XATTRS_PREREQ
  25. AT_CAPABILITIES_UTILS_PREREQ
  26. mkdir dir
  27. genfile --file dir/file
  28. setcap "= cap_chown=ei" dir/file
  29. # archive whole directory including binary xattrs
  30. tar --xattrs -cf archive.tar dir
  31. # clear the directory
  32. rm -rf dir
  33. # restore _all_ xattrs (not just the user.* domain)
  34. tar --xattrs --xattrs-include='*' -xf archive.tar
  35. getcap dir/file
  36. ],
  37. [0],
  38. [dir/file = cap_chown+ei
  39. ])
  40. AT_CLEANUP