<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - wasm-ld fails in Windows 7"
   href="https://bugs.llvm.org/show_bug.cgi?id=48378">48378</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wasm-ld fails in Windows 7
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>cs134@ukr.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, smithp352@googlemail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Recently I installed emscripten (emsdk) and it failed to compile hello world,
saying this:
wasm-ld: error: failed to write the output file: permission denied
I debugged wasm-ld and found out this:
"\llvm\lib\Support\Windows\Path.inc" have function "static std::error_code
setDeleteDisposition(HANDLE Handle, bool Delete)"
It calls SetFileInformationByHandle on file handle to set it for deletion after
closing.

But I have Windows 7 and it behaves differently from Windows 10!

"static std::error_code rename_handle(HANDLE FromHandle, const Twine &To)"
called when it tries to commit all changes done to a temporary file.
this function calls "rename_internal", and "rename_internal" calls
"GetFinalPathNameByHandleW"

On Windows 7 GetFinalPathNameByHandleW fails with error code 5
(ERROR_ACCESS_DENIED) when it tries to get path of file scheduled for deletion.

On Windows 10 everything works perfectly.

Here's sample code in Python to quickly test this behavior:
<a href="https://pastebin.com/v51m3uBU">https://pastebin.com/v51m3uBU</a>

Possible solution is to set Disposition.DeleteFile back to false before calling
GetFinalPathNameByHandleW.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>