extrac09.at 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2010-2023 Free Software Foundation, Inc.
  4. # This file is part of GNU tar.
  5. # GNU tar is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3 of the License, or
  8. # (at your option) any later version.
  9. # GNU tar is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. # This attempts to cause xgetcwd() to fail, and then checks to see if
  16. # such failure causes tar to abort even in a case where the results of
  17. # the call aren't actually needed.
  18. #
  19. # (xgetcwd() may fail e.g. on Solaris 10 when "." or ".." are unreadable.
  20. # On most systems xgetcwd() won't fail even in that situation, but
  21. # on those systems this test will simply succeed without actually testing
  22. # anything within tar.)
  23. #
  24. # http://lists.gnu.org/archive/html/bug-tar/2010-07/msg00045.html
  25. #
  26. # (See also 'listed03.at'.)
  27. AT_SETUP([extracting even when . and .. are unreadable])
  28. AT_KEYWORDS([extract extrac09 chdir])
  29. AT_TAR_CHECK([
  30. AT_UNPRIVILEGED_PREREQ
  31. mkdir dir
  32. mkdir dir/sub
  33. mkdir dir/sub/extract
  34. genfile --file dir/sub/f
  35. cd dir/sub
  36. tar -cf archive.tar f
  37. chmod a-r . ..
  38. tar -xvf archive.tar -C extract f
  39. status=$?
  40. chmod a+r . ..
  41. cmp f extract/f || status=$?
  42. exit $status
  43. ],
  44. [0],
  45. [f
  46. ],
  47. [],[],[],[gnu])
  48. AT_CLEANUP