Issue 988444: tarfile.py and multiple extended headers (original) (raw)
At the moment, tarfile.py is only able to read one extended/special header (such as GNU longname etc.) at once from an archive. In some cases there may be more than one special header to process, e.g. an archive member that points to a long linkname itself having a long name, or a GNU sparse file member with a long name. In those cases tarfile.py will fail to read that particular member including all following ones. The attached patch fixes that problem plus some minor things that I came across while fixing it:
- fixed/improved handling of extended/special headers in read-mode (adding new extended headers should be less painful now).
- improved nts() function.
- removed TarFile.chunks datastructure which is not (and was never) needed.
- fixed TarInfo.tobuf(), fields could overflow with too large values, values are now clipped.
The patch is made against 2.4a1 sources.