Author steve.dower
Recipients eryksun, miss-islington, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-11-13.19:31:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1573673520.45.0.295387839329.issue38453@roundup.psfhosted.org>
In-reply-to
Content
My latest push to PR 16967 is a significant change to what ntpath.realpath will return for broken symlinks, but I think it's the right change.

Basically, if the OS fully resolves the path, great! We'll return that (and handle \\?\ stripping)

If the OS doesn't, we'll assume it's a broken link and try and read the link target from the path. Most of the time, we'll get "not a link", but if it succeeds then we'll return here. For absolute links, we'll return it. For relative symlinks, we'll join with the parent directory. For relative anything-else, we'll return the path to the link itself.

If we can't read a link (most likely), then we'll work up the path doing the same thing. Once we successfully get further than the original path, we'll join the unprocessed tail on and return without attempting to resolve anything more (assuming that the OS would have done it earlier if it was possible).

So if you look at the changed test_ntpath.py you'll see the different results (the test_shutil.py changes are mainly to avoid long/short name comparison failures when realpath() fixes them, by putting the test files in the actual test directory instead of global TEMP).
History
Date User Action Args
2019-11-13 19:32:00steve.dowersetrecipients: + steve.dower, paul.moore, tim.golden, zach.ware, eryksun, miss-islington
2019-11-13 19:32:00steve.dowersetmessageid: <1573673520.45.0.295387839329.issue38453@roundup.psfhosted.org>
2019-11-13 19:32:00steve.dowerlinkissue38453 messages
2019-11-13 19:31:59steve.dowercreate