Re: Adding new contructors to IOMode to support "don't overwrite if already exists" behavior

Victoria Mitchell victoria at quietmisdreavus.net
Fri May 22 20:00:34 UTC 2020


On Mon, May 11, 2020, at 11:25 AM, Victoria Mitchell wrote:
> The MSVC POSIX compatibility implementation of `open()` does not define 
> the O_NOFOLLOW flag, so if you're looking for whether Windows supports 
> it, that's probably a good indicator:
> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/open-wopen?view=vs-2019
> 
> But i was under the impression that MSYS was used on Windows, which 
> defines a Linux-equivalent version of `open()`. I'm not sure how MSYS 
> deals with O_NOFOLLOW, though.

So i pulled out one of my Windows machines and set up a GHC build environment on it, so check what was available. I wasn't sure about the exact setup that was going on, and i wanted to make sure before i started adding flags.

Turns out, the minGW C compiler that GHC uses exposes the same set of flags that the MSVC C compiler does, meaning that there is no O_NOFOLLOW behavior possible on Windows. Unfortunately, this also means that the only really common flag between the major platforms that isn't already being used is O_EXCL.

Thanks,
Victoria Mitchell


More information about the Libraries mailing list