diff --git a/CMakeLists.txt b/CMakeLists.txt index 83bc3fd..505adf4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ endif() option(VBS_BUILD_TESTS "Build declaration SDK and native engine test suites" ON) option(VBS_BUILD_BENCHMARKS "Build reproducible VBS benchmark harness" ON) set(VBS_VOID_SOURCE_DIR "" CACHE PATH "Development-only VoidLibrary source override (bypasses pin)") -set(VBS_VOID_REVISION "482a3ea46b0050ec07f5063fd319e66180b4d2e4") +set(VBS_VOID_REVISION "de1fdcda72ddd6ac069fba433b13f643327efa3f") include(cmake/VoidDependency.cmake) vbs_add_void_dependency() diff --git a/build.cpp b/build.cpp index d8c9ae2..6d39580 100644 --- a/build.cpp +++ b/build.cpp @@ -6,7 +6,7 @@ void build(Void::Build::Project &project) { auto library = project.dependency("VoidLibrary"); library .git("https://git.faumaray.com/Void/VoidLibrary.git", - Void::Build::Commit{"482a3ea46b0050ec07f5063fd319e66180b4d2e4"}) + Void::Build::Commit{"de1fdcda72ddd6ac069fba433b13f643327efa3f"}) .native_builder({{"VOID_ENABLED_MODULES", "Configuration;Text;Unicode;Async;Algorithms;Crypto;Archive;Testing;Log"}, {"BUILD_SHARED_LIBS", false}}); diff --git a/cmake/VoidDependency.cmake b/cmake/VoidDependency.cmake index 5439bfc..e0d71bb 100644 --- a/cmake/VoidDependency.cmake +++ b/cmake/VoidDependency.cmake @@ -11,15 +11,11 @@ function(vbs_add_void_dependency) list(APPEND VOID_ENABLED_MODULES Testing) endif() - # Crypto (VL-007) and Archive (VL-006) now work with zero external dependencies in VoidLibrary; - # Sqlite remains opportunistic when system SQLite3 is installed. - find_package(SQLite3 QUIET) - if(SQLite3_FOUND) - list(APPEND VOID_ENABLED_MODULES Sqlite) - set(VBS_HAS_VOID_SQLITE ON PARENT_SCOPE) - else() - set(VBS_HAS_VOID_SQLITE OFF PARENT_SCOPE) - endif() + # Crypto (VL-007) and Archive (VL-006) work with zero external dependencies. + # Sqlite: Void resolves its own backend (system SQLite3, the vendored + # amalgamation, or its FetchContent fallback), so it is always available. + list(APPEND VOID_ENABLED_MODULES Sqlite) + set(VBS_HAS_VOID_SQLITE ON PARENT_SCOPE) # Void::Net (Track E4) needs Boost url/beast/asio and OpenSSL; enable it only when the # environment actually provides both, so minimal shells keep the pure-POSIX transport. diff --git a/include/Void/Build/Platform/FileOps.hpp b/include/Void/Build/Platform/FileOps.hpp index abeebc2..88f1918 100644 --- a/include/Void/Build/Platform/FileOps.hpp +++ b/include/Void/Build/Platform/FileOps.hpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -32,31 +31,12 @@ class FileLock { acquire(const std::filesystem::path &lock_path, LockMode mode = LockMode::Exclusive, bool non_blocking = false); - [[nodiscard]] bool valid() const noexcept { -#if defined(_WIN32) - return handle_ != nullptr; -#else - return lock_.locked(); -#endif - } - void release() noexcept { -#if defined(_WIN32) - handle_.reset(); -#else - lock_.unlock(); -#endif - } + [[nodiscard]] bool valid() const noexcept { return lock_.locked(); } + void release() noexcept { lock_.unlock(); } private: -#if defined(_WIN32) - explicit FileLock(std::shared_ptr handle) noexcept : handle_{std::move(handle)} {} - // Win32 HANDLE (CreateFileW + LockFileEx) with an unlock/close deleter, because - // Void::FileSystem::FileLock is POSIX-only (Void/Library issue #66). - std::shared_ptr handle_; -#else explicit FileLock(Void::FileSystem::FileLock lock) noexcept : lock_{std::move(lock)} {} Void::FileSystem::FileLock lock_; -#endif }; struct FileMetadata { diff --git a/src/Platform/Linux/FileOps.cpp b/src/Platform/Linux/FileOps.cpp index 785307a..826b141 100644 --- a/src/Platform/Linux/FileOps.cpp +++ b/src/Platform/Linux/FileOps.cpp @@ -43,44 +43,6 @@ FileLock::acquire(const std::filesystem::path &lock_path, LockMode mode, bool no lock_path.string(), ec.message()))}; } } -#if defined(_WIN32) - // Void::FileSystem::FileLock is POSIX-only (Void/Library issue #66). - const HANDLE raw = ::CreateFileW(lock_path.c_str(), GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); - if (raw == INVALID_HANDLE_VALUE) { - const DWORD err = ::GetLastError(); - return std::unexpected{Void::System::make_system_error( - Void::System::SystemErrorCode::io_error, - std::format("FileLock: cannot open '{}' (error {})", lock_path.string(), err), - static_cast(err))}; - } - OVERLAPPED overlapped{}; - DWORD flags = mode == LockMode::Exclusive ? LOCKFILE_EXCLUSIVE_LOCK : 0; - if (non_blocking) { - flags |= LOCKFILE_FAIL_IMMEDIATELY; - } - if (::LockFileEx(raw, flags, 0, MAXDWORD, MAXDWORD, &overlapped) == 0) { - const DWORD err = ::GetLastError(); - ::CloseHandle(raw); - if (non_blocking && (err == ERROR_LOCK_VIOLATION || err == ERROR_IO_PENDING)) { - return std::unexpected{Void::System::make_system_error( - Void::System::SystemErrorCode::busy, - std::format("FileLock: '{}' is already locked", lock_path.string()), EAGAIN)}; - } - return std::unexpected{Void::System::make_system_error( - Void::System::SystemErrorCode::io_error, - std::format("FileLock: locking '{}' failed (error {})", lock_path.string(), err), - static_cast(err))}; - } - auto handle = std::shared_ptr{raw, [](void *h) { - OVERLAPPED unlock{}; - (void)::UnlockFileEx(static_cast(h), 0, MAXDWORD, - MAXDWORD, &unlock); - (void)::CloseHandle(static_cast(h)); - }}; - return FileLock{std::move(handle)}; -#else const auto vl_mode = (mode == LockMode::Exclusive) ? Void::FileSystem::LockMode::Exclusive : Void::FileSystem::LockMode::Shared; if (non_blocking) { @@ -100,7 +62,6 @@ FileLock::acquire(const std::filesystem::path &lock_path, LockMode mode, bool no return std::unexpected{std::move(res.error())}; } return FileLock{std::move(*res)}; -#endif } Void::Result::Result @@ -239,47 +200,21 @@ copy_isolated(const std::filesystem::path &src, const std::filesystem::path &dst auto res = Void::FileSystem::reflink_copy_file(src, dst, opts); if (!res) { -#if defined(_WIN32) - // No reflink support on this filesystem/host: fall back to a plain copy. - std::filesystem::copy_file(src, dst, std::filesystem::copy_options::overwrite_existing, - ec); - if (ec) { - return std::unexpected{sys_err( - ec.value(), std::format("copy_isolated: copy_file failed for '{}': {}", - dst.string(), ec.message()))}; - } - return false; -#else return std::unexpected{std::move(res.error())}; -#endif } -#if defined(_WIN32) - (void)mode_override; -#else +#if !defined(_WIN32) if (mode_override) { (void)::chmod(dst.c_str(), static_cast(*mode_override)); } +#else + (void)mode_override; #endif return res->method == Void::FileSystem::CopyMethod::Reflink; } Void::Result::Result set_canonical_mtime(const std::filesystem::path &path, std::int64_t epoch_seconds) { -#if defined(_WIN32) - // Void::FileSystem::set_canonical_mtime is POSIX-only (Void/Library issue #66). - std::error_code ec; - const auto stamp = std::chrono::file_clock::from_sys( - std::chrono::system_clock::time_point{std::chrono::seconds{epoch_seconds}}); - std::filesystem::last_write_time(path, stamp, ec); - if (ec) { - return std::unexpected{ - sys_err(ec.value(), std::format("set_canonical_mtime: failed for '{}': {}", - path.string(), ec.message()))}; - } - return {}; -#else return Void::FileSystem::set_canonical_mtime(path, epoch_seconds, 0); -#endif } Void::Result::Result @@ -356,27 +291,8 @@ atomic_swap_symlink(const std::filesystem::path &link_path, const std::filesyste ec.value(), std::format("atomic_swap_symlink: create_directories failed for '{}'", parent.string()))}; } -#if defined(_WIN32) - // Void::FileSystem::atomic_symlink_swap is POSIX-only (Void/Library issue #66). - // Windows symlink creation needs privileges, so the alias becomes a regular - // file copy of the target: consumers read the same content at link_path. - std::error_code target_ec; - if (!std::filesystem::is_regular_file(target, target_ec)) { - return std::unexpected{Void::System::make_system_error( - Void::System::SystemErrorCode::unsupported, - std::format("atomic_swap_symlink: cannot alias '{}' to '{}' on Windows", - link_path.string(), target.string()))}; - } - const auto bytes = Void::FileSystem::read_file(target); - if (!bytes) { - return std::unexpected{std::move(bytes.error())}; - } - return atomic_write_bytes(link_path, std::as_bytes(std::span{*bytes}), - /*durable_sync=*/true); -#else return Void::FileSystem::atomic_symlink_swap(link_path, target, Void::FileSystem::ReplaceDurability::durable_sync); -#endif } bool path_is_within(const std::filesystem::path &root, const std::filesystem::path &path) { diff --git a/tests/DescribeContracts.cmake b/tests/DescribeContracts.cmake index a9179e2..706fafc 100644 --- a/tests/DescribeContracts.cmake +++ b/tests/DescribeContracts.cmake @@ -76,7 +76,7 @@ foreach(profile IN ITEMS debug release) endif() endforeach() expect_json(git dependencies 0 source kind) - expect_json(482a3ea46b0050ec07f5063fd319e66180b4d2e4 dependencies 0 source revision) + expect_json(de1fdcda72ddd6ac069fba433b13f643327efa3f dependencies 0 source revision) expect_json(native dependencies 0 builder) string(JSON option_type TYPE "${graph}" dependencies 0 options BUILD_SHARED_LIBS) if(NOT option_type STREQUAL "BOOLEAN") diff --git a/tests/ExampleContexts.cpp b/tests/ExampleContexts.cpp index 5393dfd..ee23d43 100644 --- a/tests/ExampleContexts.cpp +++ b/tests/ExampleContexts.cpp @@ -77,6 +77,6 @@ VOID_TEST(ExampleContexts, example_records_sources_links_and_pin) { Void::Testing::expect_eq(project.targets().at(11).name, std::string{"vbs_v1_tests"}); Void::Testing::expect_eq(project.targets().at(12).name, std::string{"vbs_selfhost_tests"}); Void::Testing::expect_eq(project.dependencies().at(0).revision, - std::string{"482a3ea46b0050ec07f5063fd319e66180b4d2e4"}); + std::string{"de1fdcda72ddd6ac069fba433b13f643327efa3f"}); Void::Testing::expect_eq(project.dependencies().at(0).builder, std::string{"native"}); }