Title
copy_symlink(junction, new_symlink)'s behavior is unclear
Status
new
Section
[fs.op.copy.symlink]
Submitter
Nicole Mazzuca

Created on 2022-07-25.00:00:00 last changed 2 weeks ago

Messages

Date: 2022-07-25.00:00:00

The specification for copy_symlink is ([fs.op.copy.symlink]):

Effects: Equivalent to function(read_symlink(existing_symlink), new_symlink) or function(read_symlink(existing_symlink, ec), new_symlink, ec), respectively, where in each case function is create_symlink or create_directory_symlink as appropriate.

The specification for read_symlink is ([fs.op.read.symlink]):

Returns: If p resolves to a symbolic link, a path object containing the contents of that symbolic link.

And finally, the definition of a "symbolic link" is ([fs.general]):

A symbolic link is a type of file with the property that when the file is encountered during pathname resolution ([fs.class.path]), a string stored by the file is used to modify the pathname resolution.

On Unix, symlink is the only kind of symbolic link. However, on Windows, there are symbolic link files which are not symlinks (app execution aliases and junctions) — this means that read_symlink should almost certainly get the target of these files if possible. However, copy_symlink specifically requires creating a symlink, not whatever type of file was there originally. IMO, copy_symlink should require its target to be a symlink. I think the original assumption was that read_symlink would take care of that for copy_symlink; this is clearly not the case on Windows, though.

History
Date User Action Args
2022-07-25 00:00:00admincreate