This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tarfile: default root:root ownership is incorrect.
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: lars.gustaebel Nosy List: jsbronder, lars.gustaebel
Priority: normal Keywords: patch

Created on 2010-06-23 22:27 by jsbronder, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-2.7-tarfile-uid-gid.patch jsbronder, 2010-06-23 22:27 review
Messages (2)
msg108493 - (view) Author: Justin Bronder (jsbronder) * Date: 2010-06-23 22:27
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
msg117960 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2010-10-04 15:39
Fixed in r85211 (py3k), r85212 (release31-maint), r85213 (release27-maint).

Thank you for the report.
History
Date User Action Args
2022-04-11 14:57:02adminsetgithub: 53311
2010-10-04 15:39:29lars.gustaebelsetstatus: open -> closed
type: behavior
messages: + msg117960

resolution: accepted
stage: resolved
2010-08-04 22:16:23terry.reedysetversions: + Python 3.1, Python 3.2, - Python 2.6, Python 2.5
2010-06-24 07:19:31lars.gustaebelsetassignee: lars.gustaebel

nosy: + lars.gustaebel
2010-06-23 22:31:42jsbrondersetcomponents: + Library (Lib)
versions: + Python 2.6
2010-06-23 22:27:35jsbrondercreate