Eryk Sun added the comment:

Junctions are sometimes used as links (e.g. mklink /j) and sometimes as volume 
mount points (e.g. mountvol.exe). GetVolumePathName can be called to 
distinguish these cases. If a junction is a volume mount point, then its 
absolute path and volume path are the same. This test is already used in 
ntpath.ismount().

For a junction link, islink() should return true, readlink() should work, and 
S_ISDIR() should return false for the lstat() st_mode. For a junction mount 
point, islink() should return false, readlink() should not work, and S_ISDIR() 
should return true for the lstat() st_mode.

A helper function could be added in fileutils.c to determine whether a reparse 
point is a link, based on the file path and reparse tag. Then modify 
_Py_attribute_data_to_stat() to take `BOOL is_link` instead of `ULONG 
reparse_tag`.

----------
nosy: +eryksun

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

Reply via email to