git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] compat/mingw: fix EACCESS when opening files with `O_CREAT | O_EXCL`
@ 2025-03-13 14:17 Patrick Steinhardt
  2025-03-13 14:17 ` [PATCH 1/2] compat/mingw: handle O_CLOEXEC in `mingw_open_existing()` Patrick Steinhardt
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Patrick Steinhardt @ 2025-03-13 14:17 UTC (permalink / raw)
  To: git; +Cc: Johannes Sixt, Johannes Schindelin

Hi,

I finally found some time to have a look at why t0610 is failing
regularly in MinGW. As it turns out the root cause is our emulation of
open(3p): when trying to open a file with `_wopen(..., O_CREAT|O_EXCL)`
the call fails in case another process has marked the same file for
deletion via `DeleteFileW()`. This gets triggered by t0610 because we
race around locking the reftable stack and thus causes the failure.

The fix is simple: we get `ERROR_ACCESS_DENIED` in this situation, so
instead of translating that error to `EACCESS` we translate it to
`EEXIST`. This fixes the flake on my machine, but as usual when it comes
to Windows I would very much like to ask those in the know to point out
any obvious mistakes I did.

The other patch is a while-at-it patch that I was wondering about while
debugging the issue. It's not needed and I'm happy to drop it if you
don't think we should include it.

Thanks!

Patrick

---
Patrick Steinhardt (2):
      compat/mingw: handle O_CLOEXEC in `mingw_open_existing()`
      compat/mingw: fix EACCESS when opening files with `O_CREAT | O_EXCL`

 compat/mingw.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)


---
base-commit: 4b68faf6b93311254efad80e554780e372deb42f
change-id: 20250313-b4-pks-mingw-lockfile-flake-49dfcce8e7c2


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-03-31  6:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13 14:17 [PATCH 0/2] compat/mingw: fix EACCESS when opening files with `O_CREAT | O_EXCL` Patrick Steinhardt
2025-03-13 14:17 ` [PATCH 1/2] compat/mingw: handle O_CLOEXEC in `mingw_open_existing()` Patrick Steinhardt
2025-03-13 17:52   ` Junio C Hamano
2025-03-13 14:17 ` [PATCH 2/2] compat/mingw: fix EACCESS when opening files with `O_CREAT | O_EXCL` Patrick Steinhardt
2025-03-13 18:02   ` Junio C Hamano
2025-03-16  0:01   ` Johannes Schindelin
2025-03-17 15:16     ` Patrick Steinhardt
2025-03-20 10:37 ` [PATCH v2 0/2] " Patrick Steinhardt
2025-03-20 10:37   ` [PATCH v2 1/2] meson: fix compat sources when compiling with MSVC Patrick Steinhardt
2025-03-20 10:37   ` [PATCH v2 2/2] compat/mingw: fix EACCESS when opening files with `O_CREAT | O_EXCL` Patrick Steinhardt
2025-03-26 12:20     ` Johannes Schindelin
2025-03-28  9:20       ` Patrick Steinhardt
2025-03-28 15:41         ` Johannes Schindelin
2025-03-31  6:57           ` Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).