Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2fdbfc5

Browse files
committed
Merged revisions 85211 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r85211 | lars.gustaebel | 2010-10-04 17:18:47 +0200 (Mon, 04 Oct 2010) | 14 lines Issue #9065: no longer use "root" as the default for the uname and gname field. If tarfile creates a new archive and adds a file with a uid/gid that doesn't have a corresponding name on the system (e.g. because the user/group account was deleted) it uses the empty string in the uname/gname field now instead of "root". Using "root" as the default was a bad idea because on extraction the uname/gname fields are supposed to override the uid/gid fields. So, all archive members with nameless uids/gids belonged to the root user after extraction. ........
1 parent 3cc7d7a commit 2fdbfc5

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

Lib/tarfile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,8 @@ def __init__(self, name=""):
923923
self.chksum = 0 # header checksum
924924
self.type = REGTYPE # member type
925925
self.linkname = "" # link name
926-
self.uname = "root" # user name
927-
self.gname = "root" # group name
926+
self.uname = "" # user name
927+
self.gname = "" # group name
928928
self.devmajor = 0 # device major number
929929
self.devminor = 0 # device minor number
930930

@@ -1102,8 +1102,8 @@ def _create_header(info, format, encoding, errors):
11021102
info.get("type", REGTYPE),
11031103
stn(info.get("linkname", ""), 100, encoding, errors),
11041104
info.get("magic", POSIX_MAGIC),
1105-
stn(info.get("uname", "root"), 32, encoding, errors),
1106-
stn(info.get("gname", "root"), 32, encoding, errors),
1105+
stn(info.get("uname", ""), 32, encoding, errors),
1106+
stn(info.get("gname", ""), 32, encoding, errors),
11071107
itn(info.get("devmajor", 0), 8, format),
11081108
itn(info.get("devminor", 0), 8, format),
11091109
stn(info.get("prefix", ""), 155, encoding, errors)

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ C-API
124124
Library
125125
-------
126126

127+
- Issue #9065: tarfile no longer uses "root" as the default for the uname and
128+
gname field.
129+
127130
- Issue #8980: Fixed a failure in distutils.command check that was shadowed
128131
by an environment that does not have docutils. Patch by Arfrever.
129132

0 commit comments

Comments
 (0)