ignfail.at 1.9 KB

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