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
182ae642
Kaydet (Commit)
182ae642
authored
Tem 13, 2010
tarafından
Stefan Krah
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #9185: On Solaris and OpenBSD, posix_getcwd() could loop indefinitely
if the path length exceeded PATH_MAX.
üst
320477e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
test_posix.py
Lib/test/test_posix.py
+7
-1
posixmodule.c
Modules/posixmodule.c
+23
-0
No files found.
Lib/test/test_posix.py
Dosyayı görüntüle @
182ae642
...
...
@@ -10,6 +10,7 @@ import time
import
os
import
pwd
import
shutil
import
sys
import
unittest
import
warnings
...
...
@@ -345,8 +346,13 @@ class PosixTester(unittest.TestCase):
os
.
chdir
(
dirname
)
try
:
os
.
getcwd
()
if
current_path_length
<
1027
:
if
current_path_length
<
4099
:
_create_and_do_getcwd
(
dirname
,
current_path_length
+
len
(
dirname
)
+
1
)
except
OSError
as
e
:
expected_errno
=
errno
.
ENAMETOOLONG
if
'sunos'
in
sys
.
platform
or
'openbsd'
in
sys
.
platform
:
expected_errno
=
errno
.
ERANGE
# Issue 9185
self
.
assertEqual
(
e
.
errno
,
expected_errno
)
finally
:
os
.
chdir
(
'..'
)
os
.
rmdir
(
dirname
)
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
182ae642
...
...
@@ -1957,6 +1957,28 @@ PyDoc_STRVAR(posix_getcwd__doc__,
"getcwd() -> path
\n\n
\
Return a string representing the current working directory."
);
#if (defined(__sun) && defined(__SVR4)) || defined(__OpenBSD__)
/* Issue 9185: getcwd() returns NULL/ERANGE indefinitely. */
static
PyObject
*
posix_getcwd
(
PyObject
*
self
,
PyObject
*
noargs
)
{
char
buf
[
PATH_MAX
+
2
];
char
*
res
;
Py_BEGIN_ALLOW_THREADS
#if defined(PYOS_OS2) && defined(PYCC_GCC)
res
=
_getcwd2
(
buf
,
sizeof
buf
);
#else
res
=
getcwd
(
buf
,
sizeof
buf
);
#endif
Py_END_ALLOW_THREADS
if
(
res
==
NULL
)
return
posix_error
();
return
PyString_FromString
(
buf
);
}
#else
static
PyObject
*
posix_getcwd
(
PyObject
*
self
,
PyObject
*
noargs
)
{
...
...
@@ -1993,6 +2015,7 @@ posix_getcwd(PyObject *self, PyObject *noargs)
return
dynamic_return
;
}
#endif
/* getcwd() NULL/ERANGE workaround. */
#ifdef Py_USING_UNICODE
PyDoc_STRVAR
(
posix_getcwdu__doc__
,
...
...
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