ignfail.at 1.9 KB

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