`zipfile` and `tarfile` docs should cover local timezone impact on entry timestamps
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
In a project that aims to emit reproducible archives, tar.xz archives were working as expected, but zip archives were ending up with timestamp discrepancies between local builds in AEST (UTC+10) and CI builds in UTC.
I eventually tracked this down to differing timestamp handling conventions in tarfile and zipfile (these conventions aren't unique to Python, so we can't readily eliminate the discrepancy, we can only document it):
tarfileuses the timestamps as they are, so if the filesystem stores timestamps in UTC (as most common filesystems other than FAT/FAT32/VFAT will do), they will be added to the file as UTC. If the filesystem stores local time, it will still be used without modification, but will probably be interpreted as UTC when the archive is extractedzipfileexplicitly interprets the filesystem timestamps withtime.localtime, so they will be added to the file as local time by default. If the filesystem already uses local time, the timezone offset will be applied a second time (potentially resulting in a stored modification time in the future for local timezones with a positive offset from UTC)
tarfile has an additional timezone related complication in that some compression formats (at least gzip) include a file creation time header: https://github.com/python/cpython/issues/75707
Discourse thread: https://discuss.python.org/t/tarfile-vs-zipfile-timezone-discrepancy-in-handling-modification-times/61016
Linked PRs
- gh-155195
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 revisando la documentación de zipfile y tarfile junto con el hilo de Discourse enlazado y el problema de la marca de tiempo de gzip. Documenta cómo afecta el manejo de la zona horaria local a las marcas de tiempo de las entradas en ambos formatos de archivo, incluida la complicación adicional de la hora de creación de gzip; el PR enlazado gh-155195 muestra que este trabajo ya está en curso.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- documentation
- Tipo de issue
- Documentación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100