[all-commits] [llvm/llvm-project] f4c01f: [Support] Fix 'keeping' temporary files on Windows 7

Alexandre Ganea via All-commits all-commits at lists.llvm.org
Mon Mar 29 12:02:09 PDT 2021


  Branch: refs/heads/release/12.x
  Home:   https://github.com/llvm/llvm-project
  Commit: f4c01f33f450f654a63363b4eb84bf744c24959c
      https://github.com/llvm/llvm-project/commit/f4c01f33f450f654a63363b4eb84bf744c24959c
  Author: Alexandre Ganea <alexandre.ganea at ubisoft.com>
  Date:   2021-03-29 (Mon, 29 Mar 2021)

  Changed paths:
    M llvm/lib/Support/Windows/Path.inc

  Log Message:
  -----------
  [Support] Fix 'keeping' temporary files on Windows 7

As reported here: https://bugs.llvm.org/show_bug.cgi?id=48378#c0
and here: https://github.com/rust-lang/rust/issues/81051
since 79657e2339b58bc01fe1b85a448bb073d57d90bb, some programs such as llvm-ar
don't work properly on Windows 7.

The issue is shown in the snippet by Oleksandr Prodan:
https://pastebin.com/v51m3uBU

In essence, once the 'DeleteFile' flag has been set on FILE_DISPOSITION_INFO,
the file path can't be queried anymore with GetFinalPathNameByHandleW. This
however works on Windows 10, GetFinalPathNameByHandleW would return sucessfully.

To workaround the issue, we simply reset the 'DeleteFile' flag before even
checking if we're dealing with a network file.

Tested with `llvm-ar r empty.a a.obj` ran on a network mount. At the moment, we
cannot specifically add a test coverage for this, since it requres mounting a
network drive.

(cherry picked from commit 64ab2b6825c5aeae6e4afa7ef0829b89a6828102)




More information about the All-commits mailing list