ignfail.at 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright (C) 2004, 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. # 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