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 eryksun
Recipients eryksun, jkloth, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2016-03-30.17:08:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1459357698.93.0.506597342914.issue26658@psf.upfronthosting.co.za>
In-reply-to
Content
I see now. It's not a problem with the junction. In the stat implementation, after verifying that the directory or file is a reparse point, it opens it again without FILE_FLAG_OPEN_REPARSE_POINT, in order to open the target instead of the link. I don't understand why it doesn't use this handle to call GetFileInformationByHandle again, this time on the target. Instead it calls get_target_path in order to recursively call stat on the target path. 

To get the target path it calls GetFinalPathNameByHandle and requests the DOS name, which requires a drive letter. At this point Windows has a native NT path (e.g. \Device\ImDisk0\python-default\PCBuild), so it has to query the mountpoint manager to get the DOS drive letter mapping (i.e. \Device\ImDisk0 => P:). This is done by opening a handle for \\.\MountPointManager and calling DeviceIoControl to query the drive letter. This is the call that fails with ERROR_INVALID_FUNCTION (1). Indeed, you'll get the same error if you try calling os.path._getfinalpathname on any directory or file on this drive.

It's probably the case that the ImDisk driver doesn't support the mountpoint manager at all. For example, in the \Global?? object directory there's no GUID symbolic link assigned to the device, which is normally assigned by the mountpoint manager. Also, mountvol.exe doesn't list the ImDisk drive.
History
Date User Action Args
2016-03-30 17:08:18eryksunsetrecipients: + eryksun, paul.moore, vstinner, tim.golden, jkloth, zach.ware, steve.dower
2016-03-30 17:08:18eryksunsetmessageid: <1459357698.93.0.506597342914.issue26658@psf.upfronthosting.co.za>
2016-03-30 17:08:18eryksunlinkissue26658 messages
2016-03-30 17:08:18eryksuncreate