[all-commits] [llvm/llvm-project] 9961c0: Return `errc::no_such_file_or_directory` in `fs::a...

Jeremy Day via All-commits all-commits at lists.llvm.org
Tue Mar 26 21:03:51 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9961c03e9ec2fc47cb42fd16141b89dd8d8e2c01
      https://github.com/llvm/llvm-project/commit/9961c03e9ec2fc47cb42fd16141b89dd8d8e2c01
  Author: Jeremy Day <jadaytime at gmail.com>
  Date:   2024-03-26 (Tue, 26 Mar 2024)

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

  Log Message:
  -----------
  Return `errc::no_such_file_or_directory` in `fs::access` if `GetFileAttributesW` fails (#83495)

Fixes https://github.com/llvm/llvm-project/issues/83046

There is a race condition when calling `GetFileAttributesW` that can
cause it to return `ERROR_ACCESS_DENIED` on a path which exists, which
is unexpected for callers using this function to check for file
existence by passing `AccessMode::Exist`. This was manifesting as a
compiler crash on Windows downstream in the Swift compiler when using
the `-index-store-path` flag (more information in
https://github.com/apple/llvm-project/issues/8224).

I looked for alternate APIs to avoid bringing in `shlwapi.h`, but didn't
see any good candidates. I'm not tied at all to this solution, any
feedback and alternative approaches are more than welcome.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list