mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
* gnu/packages/patches/rust-codex-0.98.0-core-file-lock.patch: New file. * gnu/packages/patches/rust-codex-0.98.0-core-remove-self-dep.patch: New file. * gnu/packages/patches/rust-codex-0.98.0-execpolicy-file-lock.patch: New file. * gnu/packages/patches/rust-codex-0.98.0-arg0-file-lock.patch: New file. * gnu/local.mk (dist_patch_DATA): Register them. * gnu/packages/rust-crates.scm (rust-codex-api-0.0.0.785c0c43, rust-codex-app-server-protocol-0.0.0.785c0c43, rust-codex-apply-patch-0.0.0.785c0c43, rust-codex-arg0-0.0.0.785c0c43, rust-codex-async-utils-0.0.0.785c0c43, rust-codex-client-0.0.0.785c0c43, rust-codex-common-0.0.0.785c0c43, rust-codex-core-0.0.0.785c0c43, rust-codex-execpolicy-0.0.0.785c0c43, rust-codex-experimental-api-macros-0.0.0.785c0c43, rust-codex-file-search-0.0.0.785c0c43, rust-codex-git-0.0.0.785c0c43, rust-codex-keyring-store-0.0.0.785c0c43, rust-codex-linux-sandbox-0.0.0.785c0c43, rust-codex-lmstudio-0.0.0.785c0c43, rust-codex-login-0.0.0.785c0c43, rust-codex-mcp-server-0.0.0.785c0c43, rust-codex-ollama-0.0.0.785c0c43, rust-codex-otel-0.0.0.785c0c43, rust-codex-protocol-0.0.0.785c0c43, rust-codex-rmcp-client-0.0.0.785c0c43, rust-codex-state-0.0.0.785c0c43, rust-codex-utils-absolute-path-0.0.0.785c0c43, rust-codex-utils-cache-0.0.0.785c0c43, rust-codex-utils-home-dir-0.0.0.785c0c43, rust-codex-utils-image-0.0.0.785c0c43, rust-codex-utils-json-to-toml-0.0.0.785c0c43, rust-codex-utils-pty-0.0.0.785c0c43, rust-codex-utils-readiness-0.0.0.785c0c43, rust-codex-utils-string-0.0.0.785c0c43, rust-codex-windows-sandbox-0.0.0.785c0c43): New variables. * gnu/packages/rust-crates.scm (lookup-cargo-inputs) [rust-codex-0.0.0.785c0c43, codex-app-server-protocol, codex-common, codex-core, codex-protocol, codex-utils-absolute-path]: New entries. * gnu/packages/rust-sources.scm (rust-codex-0.0.0.785c0c43): New variable. Change-Id: I3e4fceeb6f7821525a19b556fe852db6c707bae4
50 lines
1.6 KiB
Diff
50 lines
1.6 KiB
Diff
Author: Danny Milosavljevic <dannym@friendly-machines.com>
|
|
Date: 2026-01-25
|
|
License: ASL2.0
|
|
Subject: Use libc::flock instead of unstable std File::lock().
|
|
|
|
The file_lock feature is tracked at <https://github.com/rust-lang/rust/issues/130994>.
|
|
and is not yet stable in old Rust versions like Rust 1.85.
|
|
|
|
The file_lock feature was stabilized after Rust 1.88, but we only have 1.88.
|
|
|
|
diff -u a/codex-rs/execpolicy/Cargo.toml b/codex-rs/execpolicy/Cargo.toml
|
|
--- a/codex-rs/execpolicy/Cargo.toml
|
|
+++ b/codex-rs/execpolicy/Cargo.toml
|
|
@@ -19,6 +19,7 @@
|
|
[dependencies]
|
|
anyhow = { workspace = true }
|
|
clap = { workspace = true, features = ["derive"] }
|
|
+libc = { workspace = true }
|
|
multimap = { workspace = true }
|
|
serde = { workspace = true, features = ["derive"] }
|
|
serde_json = { workspace = true }
|
|
diff -u a/codex-rs/execpolicy/src/amend.rs b/codex-rs/execpolicy/src/amend.rs
|
|
--- a/codex-rs/execpolicy/src/amend.rs
|
|
+++ b/codex-rs/execpolicy/src/amend.rs
|
|
@@ -1,4 +1,5 @@
|
|
use std::fs::OpenOptions;
|
|
+use std::os::unix::io::AsRawFd;
|
|
use std::io::Read;
|
|
use std::io::Seek;
|
|
use std::io::SeekFrom;
|
|
@@ -100,10 +101,14 @@
|
|
path: policy_path.to_path_buf(),
|
|
source,
|
|
})?;
|
|
- file.lock().map_err(|source| AmendError::LockPolicyFile {
|
|
- path: policy_path.to_path_buf(),
|
|
- source,
|
|
- })?;
|
|
+ // FIXME: Use file.lock() when Rust 1.91 is available
|
|
+ let ret = unsafe { libc::flock(file.as_raw_fd(), libc::LOCK_EX) };
|
|
+ if ret != 0 {
|
|
+ return Err(AmendError::LockPolicyFile {
|
|
+ path: policy_path.to_path_buf(),
|
|
+ source: std::io::Error::last_os_error(),
|
|
+ });
|
|
+ }
|
|
|
|
let len = file
|
|
.metadata()
|