os.access() under windows

"Martin v. Löwis" martin at v.loewis.de
Wed Dec 5 05:41:16 EST 2007


> * R_OK: A process with bypass-traversal-check priv. enabled
> doesn't need any access to intervening directories in order
> to get the attributes of a file within them. This means that
> our existing R_OK result is accurate for any file: if we can
> get its attributes then you can open the file for reading.

That cannot be. There is still an ACL on the file itself which
is considered when the file is opened for reading, namely,
the "List Folder / Read Data" permission. It may be that you need
the "Read Attributes" permission to have GetFileAttributes
succeed, but that is independent from "read data".

> * W_OK: If a user has *only* read permission on a file
> (regardless of the intervening directories), we'll still return
> True for a W_OK check, as long the file doesn't have its read-only
> bit set. This means that it's possible for os.access to return True
> for a W_OK check on a file which can't then be opened for, say,
> appending.

Or any other kind of writing.

> * X_OK: No idea what we should do with this.

Well, there is the "Traverse Folder / Execute File" permission that
should be checked against (but currently isn't).

Regards,
Martin




More information about the Python-list mailing list