[Patches] [ python-Patches-1576166 ] os.utime acess denied with directories on win32

SourceForge.net noreply at sourceforge.net
Sat Oct 14 22:31:18 CEST 2006


Patches item #1576166, was opened at 2006-10-12 23:51
Message generated for change (Comment added) made by snaury
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1576166&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Submitted By: Snaury (snaury)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.utime acess denied with directories on win32

Initial Comment:
Try the following code:

>>> import os
>>> os.mkdir('8')
>>> os.utime('8',None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 13] Access is denied: '8'
>>>

This fix passes correct flags to CreateFile to
successfully open directories (when built with wide
filenames support, in other case native utime is used
and msvcrt has the very same bug).

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

>Comment By: Snaury (snaury)
Date: 2006-10-15 00:31

Message:
Logged In: YES 
user_id=1197042

You must be wrong.

First Attempt: I'm enabling Guest account on my system
(supposedly it has the least privileges), and try "file
mtime" command on my Tcl build with identical fix applied:
no error, file mtime was changed successfully.

Second Attempt: While searching the net I found this post
(http://www.cygwin.com/ml/cygwin/2006-03/msg00027.html)
which leads me to the only conclusion that SE_BACKUP_NAME
privilage is actually DISABLED by default, yet opening
directories with FILE_FLAG_BACKUP_SEMANTICS always succeeds
for me, which would not if it needed SE_BACKUP_NAME!

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

Comment By: Martin v. Löwis (loewis)
Date: 2006-10-14 23:59

Message:
Logged In: YES 
user_id=21627

The patch looks wrong. Opening a file with
FILE_FLAG_BACKUP_SEMANTICS requires the SE_BACKUP_NAME. If
the user does not have the privilege, opening will fail.
This is wrong, because the user still might be able to
change the time stamp of a regular file.

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

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


More information about the Patches mailing list