Title: Access Denied message on symlink creation misleading for an existing file/directory target.
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.2, Python 3.3
Status: closed Resolution: duplicate
Dependencies: Superseder: Bad error message in os.rename,, and os.symlink
View: 16074
Assigned To: Nosy List: loewis, santoso.wijaya, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2012-01-12 01:06 by santoso.wijaya, last changed 2013-04-13 16:30 by serhiy.storchaka. This issue is now closed.

File name Uploaded Description Edit
issue13775_py33.patch santoso.wijaya, 2012-01-12 01:09 review
Messages (5)
msg151101 - (view) Author: Santoso Wijaya (santoso.wijaya) * Date: 2012-01-12 01:06

>>> os.symlink('.\\test', 'Lib\\bar')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 5] Access is denied: '.\\test'

Where Lib\\bar is previously created. The symlink creation is rightly rejected, but with a misleading message. The failure is because 'Lib\\bar' already exists, not because of '.\\test'.
msg151102 - (view) Author: Santoso Wijaya (santoso.wijaya) * Date: 2012-01-12 01:09
Simple patch.
msg151147 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-01-12 18:52
I fail to see the bug. The output is correct, you are just misinterpreting it. It gives you the error code, error message, and original filename. It doesn't *actually* claim that the access to test is denied.

Now, changing the file in the message to the dest file doesn't really improve things. It fixes your case, but breaks cases involving problems with the source file.

So if any change is made, it should include both source and dest in the exception.
msg178514 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-29 16:57
See also issue16074.
msg186750 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-04-13 16:30
issue13775, issue16074, and issue16812 all are virtually about the same bug. There is no working patch in any issue, but the discussion in issue16074 is longer.
Date User Action Args
2013-04-13 16:30:06serhiy.storchakasetstatus: open -> closed
superseder: Bad error message in os.rename,, and os.symlink
messages: + msg186750

resolution: duplicate
stage: resolved
2012-12-29 16:57:36serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg178514
2012-01-12 18:52:13loewissetnosy: + loewis
messages: + msg151147
2012-01-12 01:09:25santoso.wijayasetfiles: + issue13775_py33.patch
keywords: + patch
messages: + msg151102
2012-01-12 01:06:47santoso.wijayacreate