feat(System): harden OwnedFd/Child process spawn, full-duplex bounds, durable replace_file, safe TempFile/TempDir, and SystemOnly consumer (M-SYSTEM-01, M-SYSTEM-02, M-SYSTEM-05)

This commit is contained in:
faumaray committed 2026-11-24 14:32:05 +03:00
1 parent 3f67b1ecb7
commit fcdbc063b2
14 files changed
+3538 -890

No files matched your search

+10
View File
@@ -116,6 +116,16 @@ if(_has_runtime)
run_consumer(RuntimeOnly "${install_prefix}" "RuntimeOnly" ${_no_external_deps})
endif()
has_modules(_has_system System Functional Time LogState)
if(_has_system)
run_consumer(SystemOnly "${install_prefix}" "SystemOnly"
-DCMAKE_DISABLE_FIND_PACKAGE_Boost=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_SQLite3=TRUE)
endif()
has_modules(_has_obs_hooks ObservabilityHooks)
if(_has_obs_hooks)
run_consumer(ObservabilityHooksOnly "${install_prefix}" "ObservabilityHooksOnly" ${_no_external_deps})
+11
View File
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 4.0)
project(VoidSystemOnlyConsumer LANGUAGES CXX)
find_package(Void CONFIG REQUIRED COMPONENTS System)
add_executable(void_system_only_consumer main.cpp)
target_link_libraries(void_system_only_consumer PRIVATE Void::System)
target_compile_features(void_system_only_consumer PRIVATE cxx_std_26)
enable_testing()
add_test(NAME SystemOnlyConsumer COMMAND void_system_only_consumer)
+31
View File
@@ -0,0 +1,31 @@
#include <Void/System/Metrics.hpp>
#include <Void/System/Path.hpp>
#include <Void/System/Process.hpp>
#include <Void/System/TempDir.hpp>
#include <iostream>
int main()
{
auto tmp = Void::FileSystem::TempDir::open("void_pkg_sys_");
if (!tmp.has_value()) {
std::cerr << tmp.error().message() << '\n';
return 1;
}
const auto cfg = tmp->path() / "item.txt";
if (!Void::FileSystem::replace_file(cfg, "ok").has_value()) {
return 2;
}
auto content = Void::FileSystem::read_file_bounded(cfg);
if (!content.has_value() || *content != "ok") {
return 3;
}
Void::Process::SpawnOptions opts;
opts.executable = "/nonexistent/void/binary";
opts.search_path = false;
auto bad = Void::Process::spawn(opts);
if (bad.has_value()) {
return 4;
}
return 0;
}