extrac06.at 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2006-2007, 2013-2014, 2016-2017 Free Software Foundation,
  4. # 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. # The bug occurs when extracting from a tarfile a directory when the directory
  17. # already exists and the version in the tarfile has more permissive
  18. # permissions than your umask. In this case, the permissions of the
  19. # existing directory will toggle between the version which complies with
  20. # your umask (which would be correct, without -p) and the version from the
  21. # tarfile.
  22. #
  23. # Reported by: Ian Jackson <[email protected]>
  24. #
  25. # References: <[email protected]>
  26. #
  27. AT_SETUP([mode of extracted directories])
  28. AT_KEYWORDS([extract extract06 directory mode])
  29. AT_TAR_CHECK([
  30. # Force umask
  31. umask 022
  32. # Make sure user's umask is honored, even if we are superuser
  33. TAR_OPTIONS="$TAR_OPTIONS --no-same-permissions"
  34. # Create a directory
  35. mkdir directory
  36. chmod 777 directory
  37. genfile --stat=mode:777 directory
  38. # Archive it
  39. tar cf arc directory
  40. # Change its permissions ...
  41. chmod 755 directory
  42. genfile --stat=mode:777 directory
  43. # ... and attempt to restore it twice
  44. tar xf arc directory --warning=no-timestamp
  45. genfile --stat=mode:777 directory
  46. tar xf arc directory --warning=no-timestamp
  47. genfile --stat=mode:777 directory
  48. # After both restores, the directory mode should be 755
  49. ],
  50. [0],
  51. [777
  52. 755
  53. 755
  54. 755
  55. ])
  56. AT_CLEANUP