chore(deps): bump VoidLibrary to de1fdcda
VoidBuildSystem CI / 1 · Requirements (push) Successful in 6s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 4m17s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 4m25s
VoidBuildSystem CI / 2B · Windows Wine build (sanitizers) (push) Successful in 5m11s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 5m25s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 6m12s
VoidBuildSystem CI / 2C · Windows native build (debug) (push) Successful in 6m20s
VoidBuildSystem CI / 2C · Windows native build (sanitizers) (push) Failing after 22s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m35s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m38s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 2m42s
VoidBuildSystem CI / 3B · Windows Wine test (sanitizers) (push) Successful in 2m45s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 2m55s
VoidBuildSystem CI / 2C · Windows native build (relwithdebinfo) (push) Successful in 4m10s
VoidBuildSystem CI / 3C · Windows native test (debug) (push) Failing after 55s
VoidBuildSystem CI / 3C · Windows native test (sanitizers) (push) Failing after 15s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m29s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m34s
VoidBuildSystem CI / 4A · Linux package (debug) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (relwithdebinfo) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (sanitizers) (push) Skipped
VoidBuildSystem CI / 3C · Windows native test (relwithdebinfo) (push) Failing after 48s
VoidBuildSystem CI / 4B · Windows package (debug) (push) Successful in 1m54s
VoidBuildSystem CI / 4B · Windows package (sanitizers) (push) Successful in 16s
VoidBuildSystem CI / 4B · Windows package (relwithdebinfo) (push) Successful in 4m0s
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 1 · Requirements (push) Successful in 6s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 4m17s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 4m25s
VoidBuildSystem CI / 2B · Windows Wine build (sanitizers) (push) Successful in 5m11s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 5m25s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 6m12s
VoidBuildSystem CI / 2C · Windows native build (debug) (push) Successful in 6m20s
VoidBuildSystem CI / 2C · Windows native build (sanitizers) (push) Failing after 22s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m35s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m38s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 2m42s
VoidBuildSystem CI / 3B · Windows Wine test (sanitizers) (push) Successful in 2m45s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 2m55s
VoidBuildSystem CI / 2C · Windows native build (relwithdebinfo) (push) Successful in 4m10s
VoidBuildSystem CI / 3C · Windows native test (debug) (push) Failing after 55s
VoidBuildSystem CI / 3C · Windows native test (sanitizers) (push) Failing after 15s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m29s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m34s
VoidBuildSystem CI / 4A · Linux package (debug) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (relwithdebinfo) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (sanitizers) (push) Skipped
VoidBuildSystem CI / 3C · Windows native test (relwithdebinfo) (push) Failing after 48s
VoidBuildSystem CI / 4B · Windows package (debug) (push) Successful in 1m54s
VoidBuildSystem CI / 4B · Windows package (sanitizers) (push) Successful in 16s
VoidBuildSystem CI / 4B · Windows package (relwithdebinfo) (push) Successful in 4m0s
VoidBuildSystem CI / 5 · Release (push) Skipped
The new pin vendors SQLite for every platform (Sqlite is now qualified on Windows), implements FileLock, symlink swap, reflink copy and timestamps on Windows (Void/Library#66), so the local Win32 lock and mtime workarounds go back to the VoidLibrary primitives, and VBS enables Void::Sqlite unconditionally since Void resolves its own backend. Verified: MinGW-w64 Windows build of all targets, vbs under Wine, SDK suite 17/17 under Wine, and the Linux suite 8/8.
This commit is contained in:
1 parent
e333bbe84b
commit
8e3fffd636
7 files changed
+14
-122
No files matched your search
@@ -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<int>(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<int>(err))};
|
||||
}
|
||||
auto handle = std::shared_ptr<void>{raw, [](void *h) {
|
||||
OVERLAPPED unlock{};
|
||||
(void)::UnlockFileEx(static_cast<HANDLE>(h), 0, MAXDWORD,
|
||||
MAXDWORD, &unlock);
|
||||
(void)::CloseHandle(static_cast<HANDLE>(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<FileMetadata, Void::Result::Error>
|
||||
@@ -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_t>(*mode_override));
|
||||
}
|
||||
#else
|
||||
(void)mode_override;
|
||||
#endif
|
||||
return res->method == Void::FileSystem::CopyMethod::Reflink;
|
||||
}
|
||||
|
||||
Void::Result::Result<void, Void::Result::Error>
|
||||
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<void, Void::Result::Error>
|
||||
@@ -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<const char>{*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) {
|
||||
|
||||
Reference in new issue
Block a user