Kaydet (Commit) 331b8002 authored tarafından Lars Gustäbel's avatar Lars Gustäbel

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.
üst f580adee
...@@ -945,8 +945,8 @@ class TarInfo(object): ...@@ -945,8 +945,8 @@ class TarInfo(object):
self.chksum = 0 # header checksum self.chksum = 0 # header checksum
self.type = REGTYPE # member type self.type = REGTYPE # member type
self.linkname = "" # link name self.linkname = "" # link name
self.uname = "root" # user name self.uname = "" # user name
self.gname = "root" # group name self.gname = "" # group name
self.devmajor = 0 # device major number self.devmajor = 0 # device major number
self.devminor = 0 # device minor number self.devminor = 0 # device minor number
...@@ -1124,8 +1124,8 @@ class TarInfo(object): ...@@ -1124,8 +1124,8 @@ class TarInfo(object):
info.get("type", REGTYPE), info.get("type", REGTYPE),
stn(info.get("linkname", ""), 100, encoding, errors), stn(info.get("linkname", ""), 100, encoding, errors),
info.get("magic", POSIX_MAGIC), info.get("magic", POSIX_MAGIC),
stn(info.get("uname", "root"), 32, encoding, errors), stn(info.get("uname", ""), 32, encoding, errors),
stn(info.get("gname", "root"), 32, encoding, errors), stn(info.get("gname", ""), 32, encoding, errors),
itn(info.get("devmajor", 0), 8, format), itn(info.get("devmajor", 0), 8, format),
itn(info.get("devminor", 0), 8, format), itn(info.get("devminor", 0), 8, format),
stn(info.get("prefix", ""), 155, encoding, errors) stn(info.get("prefix", ""), 155, encoding, errors)
......
...@@ -88,6 +88,9 @@ Core and Builtins ...@@ -88,6 +88,9 @@ Core and Builtins
Library Library
------- -------
- Issue #9065: tarfile no longer uses "root" as the default for the uname and
gname field.
- Issue #8980: Fixed a failure in distutils.command check that was shadowed - Issue #8980: Fixed a failure in distutils.command check that was shadowed
by an environment that does not have docutils. Patch by Arfrever. by an environment that does not have docutils. Patch by Arfrever.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment