Update: qualify on Windows

- Install.cpp: open the staging download with _wopen in binary mode and
  use _commit instead of fsync on Windows (O_EXCL already rejects a
  pre-existing entry, so O_NOFOLLOW has no Windows equivalent to keep).
- tests: add a @requires-openssl gate for files that sign fixtures with
  OpenSSL headers (unavailable in the Windows environment), and skip the
  compressed-package fixture when the Archive backend has no LibArchive.

Verified: Windows cross build under Wine 11 (x86_64-w64-mingw32 GCC 16.2)
966 tests, 954 passed, 12 skipped, 0 failed; Linux Update+Testing 982
tests, 978 passed, 4 skipped, 0 failed. Allowlist Update for Windows.
This commit is contained in:
faumaray committed 2026-12-06 04:00:50 +03:00
1 parent 501b6813bc
commit 695c9b6be2
6 files changed
+58 -6

No files matched your search

+1
View File
@@ -90,6 +90,7 @@ set(VOID_WINDOWS_MODULES
Text
Time
Unicode
Update
)
function(void_detect_target out_var)
+6 -2
View File
@@ -108,7 +108,7 @@ recognized and configured like Linux; musl-specific behaviour (subprocess
| CMake / generator | CMake 4.5.0, Ninja 1.13.2 |
| Language | C++26, reflection `yes` |
| Runtime | Wine 11.0 (`wine64`), no native Windows runner available |
| Modules | `Algorithms Archive Async Binary Configuration ConfigurationAsync Containers Core Crypto CryptoAsync Data Discovery Fsm Functional FunctionalCoreFormatting IO IPC Log LogConfig LogState MCP Math Memory Messaging MessagingStorage Observability ObservabilityHooks Plugin Resilience ResilienceAsync Runtime Scheduler SchedulerStorage Script Service ServicePlugin ShortUrl Sqlite Storage System SystemAsync Testing TestingMock Text Time Unicode` |
| Modules | `Algorithms Archive Async Binary Configuration ConfigurationAsync Containers Core Crypto CryptoAsync Data Discovery Fsm Functional FunctionalCoreFormatting IO IPC Log LogConfig LogState MCP Math Memory Messaging MessagingStorage Observability ObservabilityHooks Plugin Resilience ResilienceAsync Runtime Scheduler SchedulerStorage Script Service ServicePlugin ShortUrl Sqlite Storage System SystemAsync Testing TestingMock Text Time Unicode Update` |
| Observed | configure, compile, `cmake --install`, consume (`TargetProfile.exe` linked); each module's suite is verified under Wine before it is allowlisted. Full allowlisted set in one binary (Release) under Wine: **1851 tests, 1826 passed, 25 skipped, 0 failed** |
Notes from the runtime run:
@@ -135,8 +135,12 @@ Notes from the runtime run:
user identity from the process token; the endpoint file is restricted to the
current user. `adopt_pipe_pair` is not implemented on Windows yet, and the
AF_UNIX/fork-based test and the session close-during-cancel test are skipped.
- `Update` uses the Windows CRT for the staging download file (binary mode,
`_commit` instead of `fsync`); its OpenSSL-signed feed fixtures are gated by
`// @requires-openssl`, and the compressed-package fixture skips when the
Archive backend has no LibArchive.
- Still outside the Windows allowlist:
`Update` (POSIX file IO), `ShortUrlStorage` (needs `Security`), `Net`,
`ShortUrlStorage` (needs `Security`), `Net`,
`RPC`, `DiscoveryRpc`, `MessagingRpc`, `Security`, `SecurityAsync`,
`ShortUrlRemote`, `SqliteAsync`, `Stacktrace` (external dependencies not yet
built for Windows in the qualification environment).
+31 -4
View File
@@ -14,6 +14,9 @@
#include <fstream>
#include <thread>
#include <unistd.h>
#ifdef _WIN32
#include <io.h>
#endif
namespace Void::Update
{
@@ -21,6 +24,32 @@ namespace Void::Update
{
std::atomic<std::uint64_t> g_install_seq{0};
#ifdef _WIN32
// The staging file is created with O_EXCL, so a pre-existing entry
// (including a symlink) already fails the open; binary mode keeps the
// artifact bytes untouched.
constexpr int kStagingOpenFlags =
O_WRONLY | O_CREAT | O_EXCL | _O_NOINHERIT | _O_BINARY;
[[nodiscard]] int sync_file(int fd) noexcept { return ::_commit(fd); }
[[nodiscard]] int open_staging(const std::filesystem::path& path) noexcept
{
return ::_wopen(path.c_str(), kStagingOpenFlags,
_S_IREAD | _S_IWRITE);
}
#else
constexpr int kStagingOpenFlags =
O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC | O_NOFOLLOW;
[[nodiscard]] int sync_file(int fd) noexcept { return ::fsync(fd); }
[[nodiscard]] int open_staging(const std::filesystem::path& path) noexcept
{
return ::open(path.c_str(), kStagingOpenFlags, 0600);
}
#endif
[[nodiscard]] std::string sha256_hex(std::string_view data)
{
auto d = Crypto::sha256(data);
@@ -825,9 +854,7 @@ namespace Void::Update
return std::unexpected{std::move(hasher.error())};
}
int dl_fd = ::open(download_path.c_str(),
O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC | O_NOFOLLOW,
0600);
int dl_fd = open_staging(download_path);
if (dl_fd < 0) {
remove_journal_best_effort(operation_journal_path());
return std::unexpected{make_update_error(
@@ -891,7 +918,7 @@ namespace Void::Update
return {};
});
const bool sync_ok = (::fsync(dl_fd) == 0);
const bool sync_ok = (sync_file(dl_fd) == 0);
(void)::close(dl_fd);
if (!dl_res.has_value()) {
remove_journal_best_effort(operation_journal_path());
+12
View File
@@ -37,6 +37,18 @@ function(_void_test_requires_satisfied src_file active_modules active_headers ou
return()
endif()
endif()
# Whole-file OpenSSL gate: files that build signed fixtures with OpenSSL
# headers cannot be compiled where OpenSSL development files are absent
# (for example the Windows qualification environment).
if(NOT TARGET OpenSSL::Crypto)
string(FIND "${_src_content}" "// @requires-openssl" _needs_openssl)
if(NOT _needs_openssl EQUAL -1)
message(STATUS
"[VoidTests] Skipping ${src_file} (requires OpenSSL)")
set(${out_var} FALSE PARENT_SCOPE)
return()
endif()
endif()
string(REGEX MATCHALL "#[ \t]*include[ \t]*[<\"](Void/[^/\">]+/[^>\"]+)[>\"]"
_matches "${_src_content}")
set(_ok TRUE)
+1
View File
@@ -1,3 +1,4 @@
// @requires-openssl: signs feed fixtures with OpenSSL Ed25519.
#include <Void/Update/Update.hpp>
#include <Void/System/TempDir.hpp>
#include <Void/Testing/Assert.hpp>
@@ -280,6 +280,13 @@ Void::Testing::Test update_replay_floor_and_trust_store_rotation_revocation()
Void::Testing::Test update_coordinator_install_rollback_pins_cleanup_pending_and_reconcile()
{
#ifndef VOID_ARCHIVE_HAS_LIBARCHIVE
#define VOID_ARCHIVE_HAS_LIBARCHIVE 0
#endif
#if !VOID_ARCHIVE_HAS_LIBARCHIVE
Void::Testing::skip(
"needs the LibArchive backend to build a compressed .tar.zst fixture");
#endif
Void::FileSystem::TempDir tmp{"void_update_coord_"};
const auto pkg_dir = tmp / "packages";
const auto store_dir = tmp / "store";