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.

Author vstinner
Recipients brian.curtin, pitrou, vstinner
Date 2012-02-22.23:47:49
SpamBayes Score 5.658221e-06
Marked as misclassified No
Message-id <1329954470.08.0.180096078595.issue14094@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2012-02-22 23:47:50vstinnersetrecipients: + vstinner, pitrou, brian.curtin
2012-02-22 23:47:50vstinnersetmessageid: <1329954470.08.0.180096078595.issue14094@psf.upfronthosting.co.za>
2012-02-22 23:47:49vstinnerlinkissue14094 messages
2012-02-22 23:47:49vstinnercreate