[New-bugs-announce] [issue18819] tarfile fills devmajor and devminor fields even for non-devices

Nuutti Kotivuori report at bugs.python.org
Fri Aug 23 09:56:10 CEST 2013


New submission from Nuutti Kotivuori:

when tarfile generates a tar, it uses TarInfo objects which are packed to the binary format. This packing uses "itn" format for filling the "devmajor" and "devminor" fields of the tar file entry, with a default value of zero. The field length is 8 characters, and the formatting will format the values as octal strings, followed by a NUL byte, eg. '0000000\x00'.

However, other common tar tools do not exhibit this behavior, instead leaving the field filled with NUL bytes in case the earlier type field does not indicate a device type. Explicitly, the value generated by other tools is then '\x00\x00\x00\x00\x00\x00\x00\x00'.

This causes no interoperability issues (that I am aware of), but makes it hard to attempt to replicate the tar files generated by other tools exactly.

I am attaching a simple diff fixing this, but there are probably better ways to fix this.

----------
components: Library (Lib)
files: tarfile.py.diff
keywords: patch
messages: 195949
nosy: Nuutti.Kotivuori
priority: normal
severity: normal
status: open
title: tarfile fills devmajor and devminor fields even for non-devices
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file31434/tarfile.py.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18819>
_______________________________________


More information about the New-bugs-announce mailing list