[New-bugs-announce] [issue14094] nt.realpath() should use GetFinalPathNameByHandle() when available
STINNER Victor
report at bugs.python.org
Thu Feb 23 00:47:50 CET 2012
New submission from STINNER Victor <victor.stinner at gmail.com>:
nt.realpath() should use GetFinalPathNameByHandleW() when available, instead of GetFullPathNameW(), to resolve symlinks.
By the way, it's strange that Py_GetFinalPathNameByHandleW() is called with VOLUME_NAME_NT to get the buffer size, and then with VOLUME_NAME_DOS. Is it a bug?
/* We have a good handle to the target, use it to determine the
target path name. */
buf_size = Py_GetFinalPathNameByHandleW(hFile, 0, 0, VOLUME_NAME_NT);
if(!buf_size)
return win32_error_object("GetFinalPathNameByHandle", po);
target_path = (wchar_t *)malloc((buf_size+1)*sizeof(wchar_t));
if(!target_path)
return PyErr_NoMemory();
result_length = Py_GetFinalPathNameByHandleW(hFile, target_path,
buf_size, VOLUME_NAME_DOS);
See also issue #9333 (issue which added os.symlink() on Windows).
----------
components: Library (Lib)
messages: 154018
nosy: brian.curtin, haypo, pitrou
priority: normal
severity: normal
status: open
title: nt.realpath() should use GetFinalPathNameByHandle() when available
versions: Python 3.3
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14094>
_______________________________________
More information about the New-bugs-announce
mailing list