[New-bugs-announce] [issue9065] tarfile: default root:root ownership is incorrect.

Justin Bronder report at bugs.python.org
Thu Jun 24 00:27:37 CEST 2010


New submission from Justin Bronder <jsbronder at gentoo.org>:

According to the tar spec [1], uname/gname should only be filled
when they have successfully been resolved from the uid/gid.  The
tarfile module incorrectly defaults to root:root in this case.

A patch against svn trunk r82183 is included.  All tarfile unit
tests still pass with this patch.  I did not include a new unit
test as chown() is required.

Example using tarfile:
$ ls -l tarfile_user
-rw-r--r-- 1 65533 jbronder 0 2010-06-23 17:44 tarfile_user
$ python -c "import tarfile;a = tarfile.open('bleh.tar', 'w:');a.add('tarfile_user');a.list()"
-rw-r--r-- root/jbronder          0 2010-06-23 17:44:55 tarfile_user

Example using GNU tarball:
$ tar -cf bleh.tar tarfile_user
$ python -c "import tarfile;a = tarfile.open('bleh.tar').list()"
-rw-r--r-- 65533/jbronder          0 2010-06-23 17:44:55 tarfile_user

1. http://www.gnu.org/software/tar/manual/tar.html#SEC170

----------
files: python-2.7-tarfile-uid-gid.patch
keywords: patch
messages: 108493
nosy: jsbronder
priority: normal
severity: normal
status: open
title: tarfile:  default root:root ownership is incorrect.
versions: Python 2.5, Python 2.7
Added file: http://bugs.python.org/file17756/python-2.7-tarfile-uid-gid.patch

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


More information about the New-bugs-announce mailing list