You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tarfile: Make it possible to extract nested tarfiles in memory.
FileSection.skip() (see below the diff) uses 2-argument readinto, so
attempting to recursively extract archives throws an error. This commit
adds optional second argument to fix this problem. After this commit, it
is possible to extract nested archives in roughly this fashion:
with open(path, 'rb') as file:
tar_outer = tarfile.TarFile(fileobj=file)
for ti_outer in tar_outer:
tar_inner = tarfile.TarFile(
fileobj=tar_outer.extractfile(ti_outer))
for ti_inner in tar_inner:
...
Nested archives are used in some embedded contexts, for example Mender
artifacts.
Signed-off-by: Wojciech Porczyk <[email protected]>
0 commit comments