[docs] [issue9311] os.access can return bogus values when run as superuser

Garrett Cooper report at bugs.python.org
Wed Jul 21 03:32:30 CEST 2010


Garrett Cooper <yanegomi at gmail.com> added the comment:

My initial analysis was incorrect after talking with the bash(1) folks. test(1) is doing things wrong too:

        case FILEX:
                /* XXX work around eaccess(2) false positives for superuser */
                if (eaccess(nm, X_OK) != 0)
                        return 0;
                if (S_ISDIR(s.st_mode) || geteuid() != 0)
                        return 1;
                return (s.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0;

So it looks like test(1) is broken as well (doesn't check for ACLs, or MAC info).

Interesting why it's only implemented for X_OK though...

----------

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


More information about the docs mailing list