Tarfile extraction does not work on Windows
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 36k
- Merge medio
- 1 d 9 h
- PR fusionados (30 d)
- 558
Descripción
Using Python 3.10.5, there is a scenario where the extractall function of tarfile is causing an infinite loop for Python on Windows, but not in Linux.
The tar-file where the issue occurred was the one produced by docker export, where a file-system is saved as a tar file. Unfortunately, it is too big to upload here, so I will give some commands to get this file.
> docker create --name "testcontainer" tomcat
> docker export --output="testtomcat.tar" testcontainer
That should produce a file of about 457MB.
Now, using Python 3.10.5 under Windows, the following code-snippet will crash:
import tarfile
with tarfile.open("testtomcat.tar") as tarf:
members_to_extract = [tar_info for tar_info in tarf.getmembers()
if not tar_info.isdev()]
tarf.extractall(path="/tmp/foo/", members=members_to_extract)
The error says: maximum recursion depth exceeded while calling a Python object
Your environment
- CPython versions tested on: Python 3.10.5
- Operating system and architecture: Windows 11 is where it failed, and it works fine with the same python version in Arch Linux with kernel
Linux 5.15.58-2-lts x86_64
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con tarfile.extractall y el filtrado de members mostrado en el informe; después, reproduce el comportamiento en Windows usando los comandos docker create y docker export. Compara la extracción con la misma versión de Python en Linux. La tarea está terminada cuando el archivo tar exportado se pueda extraer en Windows sin el fallo por profundidad de recursión ni un bucle infinito.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- docker, python
- Área
- operating-systems
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100