ignfail.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #! /bin/sh
  2. # Unreadable directories yielded error despite --ignore-failed-read.
  3. . ./preset
  4. . $srcdir/before
  5. > check-uid
  6. set - x`ls -l check-uid`
  7. if test $3 = root; then
  8. # The test is meaningless for super-user.
  9. rm check-uid
  10. else
  11. touch file
  12. mkdir directory
  13. touch directory/file
  14. echo 1>&2 -----
  15. chmod 000 file
  16. tar cf archive file
  17. status=$?
  18. chmod 600 file
  19. test $status = 2 || exit 1
  20. echo 1>&2 -----
  21. chmod 000 file
  22. tar cf archive --ignore-failed-read file || exit 1
  23. status=$?
  24. chmod 600 file
  25. test $status = 0 || exit 1
  26. echo 1>&2 -----
  27. chmod 000 directory
  28. tar cf archive directory
  29. status=$?
  30. chmod 700 directory
  31. test $status = 2 || exit 1
  32. echo 1>&2 -----
  33. chmod 000 directory
  34. tar cf archive --ignore-failed-read directory || exit 1
  35. status=$?
  36. chmod 700 directory
  37. test $status = 0 || exit 1
  38. err="\
  39. -----
  40. tar: Cannot add file file: Permission denied
  41. tar: Error exit delayed from previous errors
  42. -----
  43. tar: Cannot add file file: Permission denied
  44. -----
  45. tar: Cannot add directory directory: Permission denied
  46. tar: Error exit delayed from previous errors
  47. -----
  48. tar: Cannot add directory directory: Permission denied
  49. "
  50. fi
  51. . $srcdir/after