ignfail.at 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2004, 2006-2007, 2013-2014, 2016 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. # Unreadable directories yielded error despite --ignore-failed-read.
  17. AT_SETUP([ignfail])
  18. AT_KEYWORDS([ignfail])
  19. AT_TAR_CHECK([
  20. # The test is meaningless for super-user.
  21. AT_UNPRIVILEGED_PREREQ
  22. touch file
  23. mkdir directory
  24. touch directory/file
  25. echo 1>&2 -----
  26. chmod 000 file
  27. tar cf archive file
  28. status=$?
  29. chmod 600 file
  30. test $status = 2 || exit 1
  31. echo 1>&2 -----
  32. chmod 000 file
  33. tar cf archive --ignore-failed-read file || exit 1
  34. status=$?
  35. chmod 600 file
  36. test $status = 0 || exit 1
  37. echo 1>&2 -----
  38. chmod 000 directory
  39. tar cf archive directory
  40. status=$?
  41. chmod 700 directory
  42. test $status = 2 || exit 1
  43. echo 1>&2 -----
  44. chmod 000 directory
  45. tar cf archive --ignore-failed-read directory || exit 1
  46. status=$?
  47. chmod 700 directory
  48. test $status = 0
  49. ],
  50. [0],
  51. [],
  52. [
  53. -----
  54. tar: file: Cannot open: Permission denied
  55. tar: Exiting with failure status due to previous errors
  56. -----
  57. tar: file: Warning: Cannot open: Permission denied
  58. -----
  59. tar: directory: Cannot open: Permission denied
  60. tar: Exiting with failure status due to previous errors
  61. -----
  62. tar: directory: Warning: Cannot open: Permission denied
  63. ])
  64. AT_CLEANUP