def _proc_pax(self, tarfile):
<EOL>buf = tarfile.fileobj.read(self._block(self.size))<EOL>if self.type == XGLTYPE:<EOL><INDENT>pax_headers = tarfile.pax_headers<EOL><DEDENT>else:<EOL><INDENT>pax_headers = tarfile.pax_headers.copy()<EOL><DEDENT>match = re.search(br"<STR_LIT>", buf)<EOL>if match is not None:<EOL><INDENT>pax_headers["<STR_LIT>"] = match.group(<NUM_LIT:1>).decode("<STR_LIT:utf8>")<EOL><DEDENT>hdrcharset = pax_headers.get("<STR_LIT>")<EOL>if hdrcharset == "<STR_LIT>":<EOL><INDENT>encoding = tarfile.encoding<EOL><DEDENT>else:<EOL><INDENT>encoding = "<STR_LIT:utf8>"<EOL><DEDENT>regex = re.compile(br"<STR_LIT>")<EOL>pos = <NUM_LIT:0><EOL>while True:<EOL><INDENT>match = regex.match(buf, pos)<EOL>if not match:<EOL><INDENT>break<EOL><DEDENT>length, keyword = match.groups()<EOL>length = int(length)<EOL>value = buf[match.end(<NUM_LIT:2>) + <NUM_LIT:1>:match.start(<NUM_LIT:1>) + length - <NUM_LIT:1>]<EOL>keyword = self._decode_pax_field(keyword, "<STR_LIT:utf8>", "<STR_LIT:utf8>",<EOL>tarfile.errors)<EOL>if keyword in PAX_NAME_FIELDS:<EOL><INDENT>value = self._decode_pax_field(value, encoding, tarfile.encoding,<EOL>tarfile.errors)<EOL><DEDENT>else:<EOL><INDENT>value = self._decode_pax_field(value, "<STR_LIT:utf8>", "<STR_LIT:utf8>",<EOL>tarfile.errors)<EOL><DEDENT>pax_headers[keyword] = value<EOL>pos += length<EOL><DEDENT>try:<EOL><INDENT>next = self.fromtarfile(tarfile)<EOL><DEDENT>except HeaderError:<EOL><INDENT>raise SubsequentHeaderError("<STR_LIT>")<EOL><DEDENT>if "<STR_LIT>" in pax_headers:<EOL><INDENT>self._proc_gnusparse_01(next, pax_headers)<EOL><DEDENT>elif "<STR_LIT>" in pax_headers:<EOL><INDENT>self._proc_gnusparse_00(next, pax_headers, buf)<EOL><DEDENT>elif pax_headers.get("<STR_LIT>") == "<STR_LIT:1>" and pax_headers.get("<STR_LIT>") == "<STR_LIT:0>":<EOL><INDENT>self._proc_gnusparse_10(next, pax_headers, tarfile)<EOL><DEDENT>if self.type in (XHDTYPE, SOLARIS_XHDTYPE):<EOL><INDENT>next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors)<EOL>next.offset = self.offset<EOL>if "<STR_LIT:size>" in pax_headers:<EOL><INDENT>offset = next.offset_data<EOL>if next.isreg() or next.type not in SUPPORTED_TYPES:<EOL><INDENT>offset += next._block(next.size)<EOL><DEDENT>tarfile.offset = offset<EOL><DEDENT><DEDENT>return next<EOL>
Process an extended or global header as described in
           POSIX.1-2008.