[issue14706] Inconsistent os.access os.X_OK on Solaris and AIX when running as root

Antoine Pitrou report at bugs.python.org
Wed May 2 13:36:11 CEST 2012


Antoine Pitrou <pitrou at free.fr> added the comment:

This is not a Python bug. os.access() is just a wrapper around the POSIX access() function:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/faccessat.html

“If any access permissions are checked, each shall be checked individually, as described in XBD File Access Permissions, except that where that description refers to execute permission for a process with appropriate privileges, an implementation may indicate success for X_OK even if execute permission is not granted to any user.”

So this seems to be a well-known portability problem accross Unix implementations. If you want to test the executable bits, just use os.stat().

----------
nosy: +pitrou
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14706>
_______________________________________


More information about the Python-bugs-list mailing list