MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _proc_gnulong

Method _proc_gnulong

tools/python-3.11.9-amd64/Lib/tarfile.py:1344–1369  ·  view source on GitHub ↗

Process the blocks that hold a GNU longname or longlink member.

(self, tarfile)

Source from the content-addressed store, hash-verified

1342 return self
1343
1344 def _proc_gnulong(self, tarfile):
1345 """Process the blocks that hold a GNU longname
1346 or longlink member.
1347 """
1348 buf = tarfile.fileobj.read(self._block(self.size))
1349
1350 # Fetch the next header and process it.
1351 try:
1352 next = self.fromtarfile(tarfile)
1353 except HeaderError as e:
1354 raise SubsequentHeaderError(str(e)) from None
1355
1356 # Patch the TarInfo object from the next header with
1357 # the longname information.
1358 next.offset = self.offset
1359 if self.type == GNUTYPE_LONGNAME:
1360 next.name = nts(buf, tarfile.encoding, tarfile.errors)
1361 elif self.type == GNUTYPE_LONGLINK:
1362 next.linkname = nts(buf, tarfile.encoding, tarfile.errors)
1363
1364 # Remove redundant slashes from directories. This is to be consistent
1365 # with frombuf().
1366 if next.isdir():
1367 next.name = next.name.removesuffix("/")
1368
1369 return next
1370
1371 def _proc_sparse(self, tarfile):
1372 """Process a GNU sparse header plus extra headers.

Callers 1

_proc_memberMethod · 0.95

Calls 8

_blockMethod · 0.95
fromtarfileMethod · 0.95
strFunction · 0.85
ntsFunction · 0.85
removesuffixMethod · 0.80
readMethod · 0.45
isdirMethod · 0.45

Tested by

no test coverage detected