Archive: run the staging implementation on Windows

Add a POSIX compatibility layer for the Windows build of StagedArchive:
directory descriptors are synthetic path handles, file IO uses the CRT
with UTF-8 to wide path conversion, fstatat/fstat/mkdirat/unlinkat/fsync
are emulated, and publication uses MoveFileExW without replace. The
isolated worker keeps its POSIX rlimit path (guarded) and RSS reporting
returns no value on Windows. Allowlist Archive for the Windows target.

Cross-built with x86_64-w64-mingw32 GCC 16.2: Void_Archive and
VoidTests.exe link with no errors. Linux Archive suite: 10/10 pass.

Refs #65
This commit is contained in:
faumaray committed 2026-12-05 16:13:57 +03:00
1 parent bd5488b15b
commit a48c745438
4 files changed
+417 -7

No files matched your search

@@ -367,10 +367,12 @@ Void::Testing::Test archive_create_formats_builtin_ustar_pax_and_gzip()
Void::Testing::expect_eq(read_file_str(tmp / "unpacked_tar/bin/tool"),
std::string{"tool-bytes"});
#ifndef _WIN32
struct stat st_tool{};
Void::Testing::require(::stat((tmp / "unpacked_tar/bin/tool").c_str(),
&st_tool) == 0);
Void::Testing::expect_eq(st_tool.st_mode & 0777, mode_t{0755});
#endif
// Staged extraction over built-in tar also succeeds (exercising
// LibArchive interop when LibArchive is linked, or built-in Reader when
@@ -487,6 +489,7 @@ Void::Testing::Test archive_staged_extraction_atomic_publish_unknown_and_cleanup
Void::Testing::expect_eq(read_file_str(parent_dir / "v1/etc/config.txt"),
std::string{"key=val"});
#ifndef _WIN32
struct stat st_exec{};
struct stat st_reg{};
Void::Testing::require(::stat((parent_dir / "v1/bin/app").c_str(), &st_exec) ==
@@ -495,6 +498,7 @@ Void::Testing::Test archive_staged_extraction_atomic_publish_unknown_and_cleanup
::stat((parent_dir / "v1/etc/config.txt").c_str(), &st_reg) == 0);
Void::Testing::expect_eq(st_exec.st_mode & 0777, mode_t{0755});
Void::Testing::expect_eq(st_reg.st_mode & 0777, mode_t{0644});
#endif
// 2. Never overwrites an existing child directory.
auto staged2 = extract_staged(archive_path, parent_dir);