os.access() under windows
Yann Leboulanger
yann.le_boulanger at u-paris10.fr
Mon Dec 3 16:15:12 EST 2007
Martin v. Löwis wrote:
> Just in case it's not clear what Tim is getting at:
>
> if a folder is marked read-only on Windows, it doesn't mean
> that you can only read from it. The read-only bit is a legacy
> thing, anyway, since you are supposed to use ACLs to mark
> a folder as read-only (by only granting write access to those
> who are supposed to write)
>
> As the read-only bit is otherwise unused, Explorer uses it
> to mark folders as being special, such a My Documents.
> So by redirecting My Documents, you set the read-only bit
> on the folder, causing access() to claim that write access
> is not granted.
>
> It would be possible to fix this specific case, by always
> returning True for directories; and perhaps I'll do that for
> 2.5.2.
>
> A more general issue is whether the ACL should also be
> taken into account. This would involve calling things like
> OpenThreadToken, MapGenericMask, and AccessCheck. These are
> all functions from the NT security API, and unavailable
> on Win9x - which is the likely reason why the MS CRT did
> not use them, either. Providing a proper access() implementation
> for NT+ then only becomes possible for 2.6 (where W9x
> is no longer supported).
>
Great, thanks for those information!
> P.S. I would never guessed that "move My Documents to test"
> doesn't mean "drag-and-drop My Documents into test", but
> "redirect My Documents to the test folder".
Right, sorry :/
--
Yann
More information about the Python-list
mailing list