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 craigh
Recipients craigh, eryksun, steve.dower, tim.golden, zach.ware
Date 2016-09-25.17:09:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474823377.34.0.0839045579867.issue23407@psf.upfronthosting.co.za>
In-reply-to
Content
The attached patch changes _Py_attribute_data_to_stat to set S_IFLNK for both symlinks and junctions, and changes win_readlink to return the target path for junctions (IO_REPARSE_TAG_MOUNT_POINT) as well as symlinks.

I'm not sure what to do as far as adding a test--either Python needs a way to create junctions or the test needs to rely on the ones Windows creates by default.

Incidentally, the existing win_readlink doesn't always work correctly with symbolic links, either (this is from 3.5.2):  

>>> import os
>>> os.readlink(r'C:\Users\All Users')
'\x00\x00f\x00\u0201\x00\x02\x00\x00\x00f\x00\x00\x00'

The problem is that PrintNameOffset is an offset in bytes, so it needs to be divided by sizeof(WCHAR) if you're going to add it to a WCHAR pointer (https://msdn.microsoft.com/en-us/library/windows/hardware/ff552012(v=vs.85).aspx).  Some links still seem to work correctly because PrintNameOffset is 0.  The attached patch fixes this problem also--I wasn't sure if I should open a separate issue for it.
History
Date User Action Args
2016-09-25 17:09:37craighsetrecipients: + craigh, tim.golden, zach.ware, eryksun, steve.dower
2016-09-25 17:09:37craighsetmessageid: <1474823377.34.0.0839045579867.issue23407@psf.upfronthosting.co.za>
2016-09-25 17:09:37craighlinkissue23407 messages
2016-09-25 17:09:37craighcreate