4
0

extrac06.at 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright (C) 2006, 2007 Free Software Foundation, Inc.
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3, or (at your option)
  7. # any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program; if not, write to the Free Software
  14. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. # 02110-1301, USA.
  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
  45. genfile --stat=mode:777 directory
  46. tar xf arc directory
  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