Script: the Runestone Services archive is unpacked without a `tarfile` filter, which Python 3.12 and 3.13 deprecate

Abierto Apto para principiantes
#3,283 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
build-system

Línea de trabajo

La llamada está en _place_runestone_services en pretext/lib/pretext.py, alrededor de la línea 3969, donde el archivo se abre con tarfile.open y luego se descomprime con extractall(build_dir). Lee esa función y reproduce el problema ejecutando una compilación HTML con python3 -W default en Python 3.12 o 3.13, y confirma la DeprecationWarning. Está terminado cuando la llamada pasa filter="data" si existe tarfile.data_filter, conserva la llamada simple para las versiones anteriores 3.10 y 3.11, y la advertencia desaparece con los mismos archivos extraídos.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

What happens

_place_runestone_services in pretext/lib/pretext.py unpacks the Runestone Services archive with extractall() and no filter argument (line 3969 at 6bcb7736). Python 3.12 and 3.13 raise a DeprecationWarning for that call:

pretext/lib/pretext.py:3969: DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.
  services_file.extractall(build_dir)

Nobody sees it in an ordinary build, because Python shows a DeprecationWarning only when it is raised from the main script, and this call is in a library module. As the warning says, from Python 3.14 the same call applies a filter by default, so what the script does there changes without the script changing.

Reproduce

Any HTML build that places Runestone Services in its own output (the default), with Python 3.12 or 3.13 told to show every warning:

python3 -W default pretext/pretext -c doc -f html -p publication.ptx -d out main.ptx

Suggested change

Name the filter where tarfile has one:

            services_file = tarfile.open(services_build_path)
            if hasattr(tarfile, "data_filter"):
                services_file.extractall(build_dir, filter="data")
            else:
                services_file.extractall(build_dir)

tarfile has the argument in Python 3.12 and later, and in the security releases 3.10.12 and 3.11.4. The script supports Python 3.10, so the earlier releases of 3.10 and 3.11 need the plain call.

Tried with Python 3.13.5 on dist-8.3.2.tgz, the two calls on their own and not inside the script: with filter="data" there is no warning, and the 450 files come out with the same names, the same contents and the same permissions as without it.

This was first noted inside #3249, which is about the same two lines and is otherwise independent.

Environment: commit 6bcb7736 (2026-10-07), Python 3.13.5, Debian 13.

Claude Opus 5.5, acting as a coding assistant for Rob Beezer

Lenguaje dominante
XSLT
Estrellas
466
Forks
251
Merge medio
4 min
PR fusionados (30 d)
13

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PreTeXtBook/pretext

Todos los issues de PreTeXtBook/pretext

Issues similares

Más issues de Build System

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.