Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
ec80ba46
Kaydet (Commit)
ec80ba46
authored
Ara 09, 2016
tarafından
Xavier de Gaye
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #26937: Merge 3.6.
üst
887b4307
f44abdab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
+23
-12
tarfile.py
Lib/tarfile.py
+19
-12
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/tarfile.py
Dosyayı görüntüle @
ec80ba46
...
...
@@ -50,9 +50,13 @@ import copy
import
re
try
:
import
grp
,
pwd
import
pwd
except
ImportError
:
grp
=
pwd
=
None
pwd
=
None
try
:
import
grp
except
ImportError
:
grp
=
None
# os.symlink on Windows prior to 6.0 raises NotImplementedError
symlink_exception
=
(
AttributeError
,
NotImplementedError
)
...
...
@@ -2219,22 +2223,25 @@ class TarFile(object):
def
chown
(
self
,
tarinfo
,
targetpath
,
numeric_owner
):
"""Set owner of targetpath according to tarinfo. If numeric_owner
is True, use .gid/.uid instead of .gname/.uname.
is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
is False, fall back to .gid/.uid when the search based on name
fails.
"""
if
pwd
and
hasattr
(
os
,
"geteuid"
)
and
os
.
geteuid
()
==
0
:
if
hasattr
(
os
,
"geteuid"
)
and
os
.
geteuid
()
==
0
:
# We have to be root to do so.
if
numeric_owner
:
g
=
tarinfo
.
gid
u
=
tarinfo
.
uid
else
:
g
=
tarinfo
.
gid
u
=
tarinfo
.
uid
if
not
numeric_owner
:
try
:
g
=
grp
.
getgrnam
(
tarinfo
.
gname
)[
2
]
if
grp
:
g
=
grp
.
getgrnam
(
tarinfo
.
gname
)[
2
]
except
KeyError
:
g
=
tarinfo
.
gid
pass
try
:
u
=
pwd
.
getpwnam
(
tarinfo
.
uname
)[
2
]
if
pwd
:
u
=
pwd
.
getpwnam
(
tarinfo
.
uname
)[
2
]
except
KeyError
:
u
=
tarinfo
.
uid
pass
try
:
if
tarinfo
.
issym
()
and
hasattr
(
os
,
"lchown"
):
os
.
lchown
(
targetpath
,
u
,
g
)
...
...
Misc/NEWS
Dosyayı görüntüle @
ec80ba46
...
...
@@ -168,6 +168,10 @@ Core and Builtins
Library
-------
-
Issue
#
26937
:
The
chown
()
method
of
the
tarfile
.
TarFile
class
does
not
fail
now
when
the
grp
module
cannot
be
imported
,
as
for
example
on
Android
platforms
.
-
Issue
#
28847
:
dbm
.
dumb
now
supports
reading
read
-
only
files
and
no
longer
writes
the
index
file
when
it
is
not
changed
.
A
deprecation
warning
is
now
emitted
if
the
index
file
is
missed
and
recreated
in
the
'r'
and
'w'
modes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment