<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3744: copy_symlink(junction, new_symlink)'s behavior is unclear</title>
<meta property="og:title" content="Issue 3744: copy_symlink(junction, new_symlink)'s behavior is unclear">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3744.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p>
<h3 id="3744"><a href="lwg-active.html#3744">3744</a>. <code>copy_symlink(junction, new_symlink)</code>'s behavior is unclear</h3>
<p><b>Section:</b> 31.12.13.6 <a href="https://wg21.link/fs.op.copy.symlink">[fs.op.copy.symlink]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Nicole Mazzuca <b>Opened:</b> 2022-07-25 <b>Last modified:</b> 2022-08-23</p>
<p><b>Priority: </b>3
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
The specification for <code>copy_symlink</code> is (31.12.13.6 <a href="https://wg21.link/fs.op.copy.symlink">[fs.op.copy.symlink]</a>):
</p>
<blockquote><p>
<i>Effects</i>: Equivalent to <code><i>function</i>(read_symlink(existing_symlink), new_symlink)</code> 
or <code><i>function</i>(read_symlink(existing_symlink, ec), new_symlink, ec)</code>, respectively,
where in each case <code><i>function</i></code> is <code>create_symlink</code> or 
<code>create_directory_symlink</code> as appropriate.
</p></blockquote>
<p>
The specification for <code>read_symlink</code> is (31.12.13.29 <a href="https://wg21.link/fs.op.read.symlink">[fs.op.read.symlink]</a>):
</p>
<blockquote><p>
<i>Returns</i>: If <code>p</code> resolves to a symbolic link, a path object containing the contents of 
that symbolic link.
</p></blockquote>
<p>
And finally, the definition of a "symbolic link" is (31.12.1 <a href="https://wg21.link/fs.general">[fs.general]</a>):
</p>
<blockquote><p>
A <i>symbolic link</i> is a type of file with the property that when the file is encountered during pathname
resolution (31.12.6 <a href="https://wg21.link/fs.class.path">[fs.class.path]</a>), a string stored by the file is used to modify the pathname resolution.
</p></blockquote>
<p>
On Unix, <code>symlink</code> is the only kind of symbolic link. However, on Windows, there are symbolic 
link files which are <em>not</em> <code>symlink</code>s (app execution aliases and junctions) &mdash; this 
means that <code>read_symlink</code> should almost certainly get the target of these files if possible. 
However, <code>copy_symlink</code> specifically requires creating a <em><code>symlink</code></em>, not whatever 
type of file was there originally. IMO, <code>copy_symlink</code> should require its target to be a symlink. 
I think the original assumption was that <code>read_symlink</code> would take care of that for 
<code>copy_symlink</code>; this is clearly not the case on Windows, though.
</p>

<p><i>[2022-08-23; Reflector poll]</i></p>

<p>
Set priority to 3 after reflector poll.
</p>



<p id="res-3744"><b>Proposed resolution:</b></p>





</body>
</html>
