[ python-Bugs-991735 ] os.access reports true for read-only directories

SourceForge.net noreply at sourceforge.net
Thu Jul 15 21:25:57 CEST 2004


Bugs item #991735, was opened at 2004-07-15 13:08
Message generated for change (Comment added) made by mmoales
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=991735&group_id=5470

Category: Windows
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Mark Moales (mmoales)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.access reports true for read-only directories

Initial Comment:
It appears that os.access incorrectly reports write 
access to directories on network drives.  For example, if 
I have a read-only directory called foo\bar on a machine 
called homeserver, the following code always returns 
true:

print os.access("\\homeserver\foo\bar", os.W_OK)
True

Similarly, if I map above directory to a drive, the results 
are the same, i.e.:

print os.access("H:\bar", os.W_OK)
True

However, if I try to create a file in that directory, I get 
a permission error:

f = file("h:\foo\bar\test.txt", 'w+b')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 13] Permission 
denied: 'h:\foo\bar\test.txt'

----------------------------------------------------------------------

>Comment By: Mark Moales (mmoales)
Date: 2004-07-15 15:25

Message:
Logged In: YES 
user_id=565165

This may not be a bug afterall.  I think it has to do with 
Window's ACLs.  I believe os.access is just looking at access 
bits.  For example, I can create a directory and leave it as 
writable, but prevent access to it via an ACL.  In this case, 
os.access reports true, but any operation you try to perform 
on the dictionary get's a permission error.  It might just need 
to be mentioned in the os.access doc.

Thomas: no problem

----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2004-07-15 15:20

Message:
Logged In: YES 
user_id=11105

Tim: I didn't know that.  Thanks for disabling it.

Mark: Sorry, it wasn't your fault.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2004-07-15 14:56

Message:
Logged In: YES 
user_id=31435

The tracker was set to auto-assign Windows reports to you, 
Thomas.  I disabled that (and Windows reports will be 
assigned to None by default now).

----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2004-07-15 14:41

Message:
Logged In: YES 
user_id=11105

Please don't assign windows bugs to me.  Thanks.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=991735&group_id=5470


More information about the Python-bugs-list mailing list