summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2012-06-23 02:50:21 (GMT)
committerLarry Hastings <larry@hastings.org>2012-06-23 02:50:21 (GMT)
commitdbbc0c8bb39a8b92692f03491c9384d9c068b9e2 (patch)
tree49556985a014aab3a90903b97bc7ab1c18b3b822 /Lib/os.py
parentfafd9eeef04ae4ac388bf2fbd0695c2f08eee68e (diff)
downloadcpython-dbbc0c8bb39a8b92692f03491c9384d9c068b9e2.zip
cpython-dbbc0c8bb39a8b92692f03491c9384d9c068b9e2.tar.gz
cpython-dbbc0c8bb39a8b92692f03491c9384d9c068b9e2.tar.bz2
Issue #14626: Fix buildbot issue on OpenIndiana 3.x machines. (Hopefully.)
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/Lib/os.py b/Lib/os.py
index fc8b92e..b5ad1b5 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -179,16 +179,27 @@ if _exists("_have_functions"):
_set = set()
_add("HAVE_FACCESSAT", "access")
- # Current linux (kernel 3.2, glibc 2.15) doesn't support lchmod.
- # (The function exists, but it's a stub that always returns ENOSUP.)
- # Now, linux *does* have fchmodat, which says it can ignore
- # symbolic links. But that doesn't work either (also returns ENOSUP).
- # I'm guessing that if they fix fchmodat, they'll also add lchmod at
- # the same time. So, for now, assume that fchmodat doesn't support
- # follow_symlinks unless lchmod works.
- if ((sys.platform != "linux") or
- ("HAVE_LCHMOD" in _have_functions)):
- _add("HAVE_FCHMODAT", "chmod")
+ # Some platforms don't support lchmod(). Often the function exists
+ # anyway, as a stub that always returns ENOSUP or perhaps EOPNOTSUPP.
+ # (No, I don't know why that's a good design.) ./configure will detect
+ # this and reject it--so HAVE_LCHMOD still won't be defined on such
+ # platforms. This is Very Helpful.
+ #
+ # However, sometimes platforms without a working lchmod() *do* have
+ # fchmodat(). (Examples: Linux kernel 3.2 with glibc 2.15,
+ # OpenIndiana 3.x.) And fchmodat() has a flag that theoretically makes
+ # it behave like lchmod(). So in theory it would be a suitable
+ # replacement for lchmod(). But when lchmod() doesn't work, fchmodat()'s
+ # flag doesn't work *either*. Sadly ./configure isn't sophisticated
+ # enough to detect this condition--it only determines whether or not
+ # fchmodat() minimally works.
+ #
+ # Therefore we simply ignore fchmodat() when deciding whether or not
+ # os.chmod supports follow_symlinks. Just checking lchmod() is
+ # sufficient. After all--if you have a working fchmodat(), your
+ # lchmod() almost certainly works too.
+ #
+ # _add("HAVE_FCHMODAT", "chmod")
_add("HAVE_FCHOWNAT", "chown")
_add("HAVE_FSTATAT", "stat")
_add("HAVE_LCHFLAGS", "chflags")