Discussed in #2809
Originally posted by operatios June 21, 2022
I do understand that symbolic links and junctions are different, still, they both point to a target. For example, as a user, I expected to be able to successfully read both "C:\Users\All Users" (a symbolic link) and "C:\Users\Default User" (a junction).
After looking at the source code:
|
if (_Buffer->_Reparse_tag == IO_REPARSE_TAG_SYMLINK) { |
I see that only
IO_REPARSE_TAG_SYMLINK is checked, and in case of junctions (tag value
IO_REPARSE_TAG_MOUNT_POINT), an error
ERROR_REPARSE_TAG_INVALID is returned. This would be fine if there existed a function like
read_junction, but as far as I am aware, there is none.
This feels weird to me since other in programming languages like Python, Rust and Go you are able to successfully read both junctions and symbolic links on Windows. Here is a reference to their implementations, if needed: Python's os.readlink, Rust's fs::read_link and Go's os.Readlink.
After doing some more investigation, I found that a similar question was raised as an issue in boost: boostorg/filesystem#125 and later was fixed. I am just not sure whether this is a bug or not, since libc++'s read_symlink also does not support junctions.
Is this something that is not allowed by the C++ Standard, or is there another reason?
Other questions?
- What do we do about other types of reparse points, like app execution aliases?
Discussed in #2809
Originally posted by operatios June 21, 2022
I do understand that symbolic links and junctions are different, still, they both point to a target. For example, as a user, I expected to be able to successfully read both
"C:\Users\All Users"(a symbolic link) and"C:\Users\Default User"(a junction).After looking at the source code:
STL/stl/src/filesystem.cpp
Line 515 in 7f04137
IO_REPARSE_TAG_SYMLINKis checked, and in case of junctions (tag valueIO_REPARSE_TAG_MOUNT_POINT), an errorERROR_REPARSE_TAG_INVALIDis returned. This would be fine if there existed a function likeread_junction, but as far as I am aware, there is none.This feels weird to me since other in programming languages like Python, Rust and Go you are able to successfully read both junctions and symbolic links on Windows. Here is a reference to their implementations, if needed: Python's os.readlink, Rust's fs::read_link and Go's os.Readlink.
After doing some more investigation, I found that a similar question was raised as an issue in boost: boostorg/filesystem#125 and later was fixed. I am just not sure whether this is a bug or not, since libc++'s
read_symlinkalso does not support junctions.Is this something that is not allowed by the C++ Standard, or is there another reason?
Other questions?