diff options
author | Stefan Krah <stefan@bytereef.org> | 2010-07-13 19:17:08 +0000 |
---|---|---|
committer | Stefan Krah <stefan@bytereef.org> | 2010-07-13 19:17:08 +0000 |
commit | 182ae64235c510c7b40f7b26a1490d3f2163d00d (patch) | |
tree | 3550cad403a9f785791d3055e6c9bfb309057c13 /Lib/test/test_posix.py | |
parent | 320477e4db8fb2484d920db2c888eab46eef7692 (diff) | |
download | cpython-git-182ae64235c510c7b40f7b26a1490d3f2163d00d.tar.gz |
Issue #9185: On Solaris and OpenBSD, posix_getcwd() could loop indefinitely
if the path length exceeded PATH_MAX.
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r-- | Lib/test/test_posix.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index afeb616ddc..d2c768afca 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -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) |