Why does filesystem::read_symlink ignore junctions? #2809
-
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 After looking at the source code: Line 515 in 7f04137 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 Is this something that is not allowed by the C++ Standard, or is there another reason? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I see the same issue: #2077 |
Beta Was this translation helpful? Give feedback.
-
@barcharcraz points out that the standard wording for
With the definition of "symbolic link" being ([fs.general]/def:symbolic_link):
This says to me that junctions should be considered symbolic links, and therefore There is a question here, which is whether So, to answer your question: I do believe that this is a bug. |
Beta Was this translation helpful? Give feedback.
@barcharcraz points out that the standard wording for
read_symlink
is ([fs.op.read.symlink]/1):With the definition of "symbolic link" being ([fs.general]/def:symbolic_link):
This says to me that junctions should be considered symbolic links, and therefore
read_symlink
andcopy_symlink
should do the obvious thing with junctions as well.There is a question here, which is whether
copy…