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

Garrett Cooper report at bugs.python.org
Wed Jul 21 03:32:54 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...

Based on this analysis, I'd say that access(2) is broken on FreeBSD and needs to be fixed.


Python tracker <report at bugs.python.org>

More information about the docs mailing list