From 88cecb72c9988597b17eb04e7ce77625f3d1c9fb Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sun, 6 Dec 2026 02:20:31 +0300 Subject: [PATCH] Storage: qualify the Windows file port Fix the Windows compatibility layer: open files in binary mode (WAL data was being CRLF-translated), replace destination on rename like POSIX, use handle-backed directory descriptors so FlushFileBuffers works, and enforce O_NOFOLLOW via reparse-point checks. The Storage test's symlink setup is now portable. Allowlist Storage for the Windows target. Windows cross build under Wine 11 (x86_64-w64-mingw32 GCC 16.2): the Storage suites pass (5 passed, 1 skipped); the remaining failures in the full run are IO tests that need the Linux-only native backend. --- cmake/Targets.cmake | 1 + src/Storage/FilePort.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/Targets.cmake b/cmake/Targets.cmake index aa46f5c..bdbe25a 100644 --- a/cmake/Targets.cmake +++ b/cmake/Targets.cmake @@ -67,6 +67,7 @@ set(VOID_WINDOWS_MODULES Scheduler Service Sqlite + Storage System Testing TestingMock diff --git a/src/Storage/FilePort.cpp b/src/Storage/FilePort.cpp index bbb7a38..0c99b1e 100644 --- a/src/Storage/FilePort.cpp +++ b/src/Storage/FilePort.cpp @@ -268,7 +268,9 @@ inline int open(const wchar_t* path, const int flags, const int mode = 0) } return fd; } - return ::_wopen(path, flags & ~O_NOFOLLOW, mode); + // Storage files are binary: never let the CRT translate CRLF or treat + // 0x1A as EOF. + return ::_wopen(path, (flags & ~O_NOFOLLOW) | _O_BINARY, mode); } #endif // _WIN32