code: def test_onerror_retry():
      archive._make_dirs("onerror_retry")
  
      with open("onerror_retry/one.txt", "w") as f:
          f.write("one")
  
      os.chmod("onerror_retry/one.txt", 0o0222)
      tar_path = yatest.common.output_path("onerror_retry.tar")
  
      def onerror(src, dst, exc_info):
          if six.PY2:
              assert exc_info[0] == IOError
          else:
              assert exc_info[0] == PermissionError
          assert exc_info[1].errno == errno.EACCES
          os.chmod(src, 0o0555)
          return True
  
      with open(tar_path, "w") as afile:
          archive.tar("onerror_retry", afile, onerror=onerror)
  
      with tarfile.open(tar_path) as tar:
          tar.getmembers() == ["onerror_retry/one.txt"]
          assert (
              tar.extractfile("onerror_retry/one.txt").read() == b"one"
          )
  
imports: import errno
  import hashlib
  import os
  import shutil
  import socket
  import tarfile
  import threading
  import six
  import pytest
  import yatest.common
  import library.python.archive
label_desc: Use image node_id 18 for calling a global function with example usage: test_onerror_retry() and returns: True