This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.access reports incorrect write permissions in Windows
Type: Stage:
Components: Windows Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: loewis, nnorwitz, yi_ding
Priority: high Keywords:

Created on 2006-06-27 22:01 by yi_ding, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-20060630-accessfix.patch yi_ding, 2006-06-30 23:12
Messages (6)
msg28954 - (view) Author: Yi S. Ding (yi_ding) Date: 2006-06-27 22:01
Platform: Python 2.5b1 Windows XP

Bug:
os.access will report that a user doesn't have write
permissions to a file or directory when the user
actually does.

Reproducibility: always

This is being run on an administrator account.
>>> import os
>>> os.access("C:\\", os.W_OK)
False
>>> os.access("C:\\test.txt", os.W_OK)
False

I have also checked that Python can indeed write to the
file.
msg28955 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-06-28 05:28
Logged In: YES 
user_id=33168

Does this problem only occur with 2.5 or is it also present
in 2.4?
msg28956 - (view) Author: Yi S. Ding (yi_ding) Date: 2006-06-29 19:56
Logged In: YES 
user_id=1081617

Yeah, it's only 2.5, and only 2.5b1.  Basically, there's a
double ampersand used instead of a single ampersand in
posixmodule.c.  I've attached the patch.
msg28957 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-06-30 07:12
Logged In: YES 
user_id=33168

Your change looks correct, but I would really like a test
case to fix this problem.  I don't have access to a Windows
box, so I can't verify the test fails before this patch and
succeeds with it.  Can you create a test case too?  The best
place to add the test would be Lib/test/test_posix.py.  Thanks!
msg28958 - (view) Author: Yi S. Ding (yi_ding) Date: 2006-06-30 23:12
Logged In: YES 
user_id=1081617

Cool.  I added the new patch with the test case.
msg28959 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-07-02 18:45
Logged In: YES 
user_id=21627

Thanks for the report and the patch, committed as r47198 (I
moved the test in a separate class, though).
History
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43564
2006-06-27 22:01:02yi_dingcreate