Eryk Sun <eryk...@gmail.com> added the comment:

os.stat() was redesigned in issue 37834, which entailed extensive updates 
across the standard library to improve support for Windows reparse points. As 
part of this,  Win32JunctionTests.tearDown() was changed to use a more reliable 
lexists() check, which resolves this issue.

FYI, the new implementation of os.stat() supports an ImDisk virtual disk 
(v2.0.9 from 2015-12). In the following example, "junctest" is a mountpoint 
(junction) in an NTFS filesystem. The filesystem is mounted on an ImDisk 
device, as seen its VOLUME_NAME_NT (2) path:

    >>> flags = win32file.FILE_FLAG_OPEN_REPARSE_POINT
    >>> flags |= win32file.FILE_FLAG_BACKUP_SEMANTICS
    >>> h = win32file.CreateFile('junctest', 0, 0, None, 3, flags, None)
    >>> win32file.GetFinalPathNameByHandle(h, 2)
    '\\Device\\ImDisk0\\junctest'

stat() traverses the mountpoint:

    >>> os.stat('junctest').st_reparse_tag == 0
    True

lstat() opens the mountpoint:

    >>> os.lstat('junctest').st_reparse_tag == stat.IO_REPARSE_TAG_MOUNT_POINT
    True

This version of Imdisk doesn't support the mountpoint manager, so trying to get 
the VOLUME_NAME_DOS (0) name of r"\Device\ImDisk0" (e.g. r"\\?\R:") still fails 
the same as before:

    >>> win32file.GetFinalPathNameByHandle(h, 0)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    pywintypes.error: (1, 'GetFinalPathNameByHandle', 'Incorrect function.')

But os.stat() no longer needs it.

----------
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
superseder:  -> readlink on Windows cannot read app exec links

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue26658>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to