Commit f3c0fc29 authored by Lars Gustäbel's avatar Lars Gustäbel

Merge with 3.2: Issue #12841: Fix tarfile extraction of non-existent uids/gids.

parents 7d1d20a9 2f476e91
...@@ -2366,17 +2366,11 @@ class TarFile(object): ...@@ -2366,17 +2366,11 @@ class TarFile(object):
try: try:
g = grp.getgrnam(tarinfo.gname)[2] g = grp.getgrnam(tarinfo.gname)[2]
except KeyError: except KeyError:
try: g = tarinfo.gid
g = grp.getgrgid(tarinfo.gid)[2]
except KeyError:
g = os.getgid()
try: try:
u = pwd.getpwnam(tarinfo.uname)[2] u = pwd.getpwnam(tarinfo.uname)[2]
except KeyError: except KeyError:
try: u = tarinfo.uid
u = pwd.getpwuid(tarinfo.uid)[2]
except KeyError:
u = os.getuid()
try: try:
if tarinfo.issym() and hasattr(os, "lchown"): if tarinfo.issym() and hasattr(os, "lchown"):
os.lchown(targetpath, u, g) os.lchown(targetpath, u, g)
......
...@@ -271,6 +271,11 @@ Core and Builtins ...@@ -271,6 +271,11 @@ Core and Builtins
Library Library
------- -------
- Issue #12841: tarfile unnecessarily checked the existence of numerical user
and group ids on extraction. If one of them did not exist the respective id
of the current user (i.e. root) was used for the file and ownership
information was lost.
- Issue #12888: Fix a bug in HTMLParser.unescape that prevented it to escape - Issue #12888: Fix a bug in HTMLParser.unescape that prevented it to escape
more than 128 entities. Patch by Peter Otten. more than 128 entities. Patch by Peter Otten.
......
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