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
fba807ac
Kaydet (Commit)
fba807ac
authored
Nis 17, 2012
tarafından
Charles-François Natali
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #5113: Fix a test_posix failure on HP-UX, where non-root users can
chown() to root under certain circumstances.
üst
c8ce715a
ab2d58ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
test_posix.py
Lib/test/test_posix.py
+9
-2
No files found.
Lib/test/test_posix.py
Dosyayı görüntüle @
fba807ac
...
@@ -10,6 +10,7 @@ import sys
...
@@ -10,6 +10,7 @@ import sys
import
time
import
time
import
os
import
os
import
fcntl
import
fcntl
import
platform
import
pwd
import
pwd
import
shutil
import
shutil
import
stat
import
stat
...
@@ -390,6 +391,9 @@ class PosixTester(unittest.TestCase):
...
@@ -390,6 +391,9 @@ class PosixTester(unittest.TestCase):
def
_test_all_chown_common
(
self
,
chown_func
,
first_param
):
def
_test_all_chown_common
(
self
,
chown_func
,
first_param
):
"""Common code for chown, fchown and lchown tests."""
"""Common code for chown, fchown and lchown tests."""
# test a successful chown call
chown_func
(
first_param
,
os
.
getuid
(),
os
.
getgid
())
if
os
.
getuid
()
==
0
:
if
os
.
getuid
()
==
0
:
try
:
try
:
# Many linux distros have a nfsnobody user as MAX_UID-2
# Many linux distros have a nfsnobody user as MAX_UID-2
...
@@ -401,12 +405,15 @@ class PosixTester(unittest.TestCase):
...
@@ -401,12 +405,15 @@ class PosixTester(unittest.TestCase):
chown_func
(
first_param
,
ent
.
pw_uid
,
ent
.
pw_gid
)
chown_func
(
first_param
,
ent
.
pw_uid
,
ent
.
pw_gid
)
except
KeyError
:
except
KeyError
:
pass
pass
elif
platform
.
system
()
in
(
'HP-UX'
,
'SunOS'
):
# HP-UX and Solaris can allow a non-root user to chown() to root
# (issue #5113)
raise
unittest
.
SkipTest
(
"Skipping because of non-standard chown() "
"behavior"
)
else
:
else
:
# non-root cannot chown to root, raises OSError
# non-root cannot chown to root, raises OSError
self
.
assertRaises
(
OSError
,
chown_func
,
self
.
assertRaises
(
OSError
,
chown_func
,
first_param
,
0
,
0
)
first_param
,
0
,
0
)
# test a successful chown call
chown_func
(
first_param
,
os
.
getuid
(),
os
.
getgid
())
@unittest.skipUnless
(
hasattr
(
posix
,
'chown'
),
"test needs os.chown()"
)
@unittest.skipUnless
(
hasattr
(
posix
,
'chown'
),
"test needs os.chown()"
)
def
test_chown
(
self
):
def
test_chown
(
self
):
...
...
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