Issue14094
Created on 2012-02-22 23:47 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 11248 | closed | v2m, 2018-12-20 07:34 | |
| Messages (10) | |||
|---|---|---|---|
| msg154018 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2012-02-22 23:47 | |
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).
|
|||
| msg222954 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2014-07-13 16:42 | |
I'm assuming that this should be treated as an enhancement request. |
|||
| msg297133 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2017-06-28 01:44 | |
Python 3 now uses GetFinalPathNameByHandle()! |
|||
| msg297139 - (view) | Author: Eryk Sun (eryksun) * ![]() |
Date: 2017-06-28 02:25 | |
I assume by nt.realpath we're talking about ntpath.realpath. In that case nothing was done to fix this. It's still an alias for ntpath.abspath, which calls GetFullPathNameW. |
|||
| msg297188 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2017-06-28 14:33 | |
Oh, only os.stat() was patched to use GetFinalPathNameByHandle()? It seems like most of the code was already written, so it shouldn't be hard to add a nt.GetFinalPathName() function using the win32_xstat_impl() code (and get_target_path()), to implement a real ntpath.realpath(), no? @Eryk: Are you interested to work on a patch? |
|||
| msg332094 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2018-12-18 22:38 | |
Any update on this issue? |
|||
| msg332152 - (view) | Author: Vladimir Matveev (v2m) * | Date: 2018-12-19 17:03 | |
I can give it a try. |
|||
| msg335040 - (view) | Author: Eryk Sun (eryksun) * ![]() |
Date: 2019-02-07 20:33 | |
Ping on PR 11248. It would be nice to get this into 3.8. |
|||
| msg335042 - (view) | Author: Steve Dower (steve.dower) * ![]() |
Date: 2019-02-07 22:08 | |
Posted a review. I suggest a few changes for the sake of tidying up, but I agree that I'd like to see more tests added. |
|||
| msg351857 - (view) | Author: Steve Dower (steve.dower) * ![]() |
Date: 2019-09-11 13:13 | |
As of 3.8, it (sort of) does. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:27 | admin | set | github: 58302 |
| 2019-09-11 13:13:11 | steve.dower | set | status: open -> closed resolution: out of date messages: + msg351857 stage: patch review -> resolved |
| 2019-02-26 02:32:10 | eryksun | link | issue36112 superseder |
| 2019-02-07 22:08:46 | steve.dower | set | messages: + msg335042 |
| 2019-02-07 20:33:37 | eryksun | set | messages: + msg335040 |
| 2019-02-07 20:20:32 | eryksun | set | nosy:
+ paul.moore, tim.golden, zach.ware, steve.dower components: + Windows |
| 2019-02-07 20:19:53 | eryksun | set | components: - Windows |
| 2018-12-20 07:34:22 | v2m | set | keywords:
+ patch stage: needs patch -> patch review pull_requests: + pull_request10488 |
| 2018-12-19 17:03:44 | v2m | set | nosy:
+ v2m messages: + msg332152 |
| 2018-12-18 22:38:14 | vstinner | set | messages:
+ msg332094 versions: + Python 3.8, - Python 3.7 |
| 2017-06-28 14:33:45 | vstinner | set | messages: + msg297188 |
| 2017-06-28 14:13:19 | BreamoreBoy | set | nosy:
- BreamoreBoy |
| 2017-06-28 02:25:56 | eryksun | set | status: closed -> open title: nt.realpath() should use GetFinalPathNameByHandle() when available -> ntpath.realpath() should use GetFinalPathNameByHandle() |
| 2017-06-28 01:44:50 | vstinner | set | status: open -> closed resolution: fixed messages: + msg297133 stage: resolved |
| 2014-07-13 16:42:31 | BreamoreBoy | set | versions:
+ Python 3.5, - Python 3.3 nosy: + BreamoreBoy messages: + msg222954 type: enhancement |
| 2013-01-03 01:15:21 | vstinner | set | components: + Windows |
| 2012-02-27 09:31:35 | petri.lehtinen | set | nosy:
+ petri.lehtinen |
| 2012-02-22 23:48:11 | vstinner | set | nosy:
+ amaury.forgeotdarc |
| 2012-02-22 23:47:49 | vstinner | create | |

