rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 heartwood39c5172901411fb2859beeff89b61cb315ee8105
{
"request": "trigger",
"version": 1,
"event_type": "patch",
"repository": {
"id": "rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5",
"name": "heartwood",
"description": "Radicle Heartwood Protocol & Stack",
"private": false,
"default_branch": "master",
"delegates": [
"did:key:z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT",
"did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"did:key:z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz"
]
},
"action": "Created",
"patch": {
"id": "c21654de722a541bc926ec8a9a477f896525771f",
"author": {
"id": "did:key:z6MkpJ857fbgh2sRyu13owW9gVtXA3G18VeU1Yfojy4QyzCZ",
"alias": "shawn.webb"
},
"title": "Fix build on FreeBSD/HardenedBSD",
"state": {
"status": "merged",
"conflicts": []
},
"before": "6ab3bfcba0577fabdcb84498441c6605391290f4",
"after": "39c5172901411fb2859beeff89b61cb315ee8105",
"commits": [
"39c5172901411fb2859beeff89b61cb315ee8105",
"cff26ff44fad987d34044c0294da0ff4b0fa69bc",
"36c10fac855f5a25627f8f9b68e86bfb4800e3a4",
"8bff6c9405eb8dee1699feb437ea29c4dfeed18d"
],
"target": "7e1cb406bb935c3de008d2171e8961f57b4336ea",
"labels": [],
"assignees": [],
"revisions": [
{
"id": "c21654de722a541bc926ec8a9a477f896525771f",
"author": {
"id": "did:key:z6MkpJ857fbgh2sRyu13owW9gVtXA3G18VeU1Yfojy4QyzCZ",
"alias": "shawn.webb"
},
"description": "I'm not entirely sure that the inode changes will work on Linux. But\nthis commit fixes the Radicle build for these applications:\n\n1. radicle-cli\n2. radicle-httpd\n3. radicle-node\n4. radicle-remote-helper\n5. radicle-tools\n\nSigned-off-by:\tShawn Webb <shawn.webb@hardenedbsd.org>",
"base": "6ab3bfcba0577fabdcb84498441c6605391290f4",
"oid": "492b50387620b17f9fc696aebaa55fdcd2fe2daa",
"timestamp": 1715131651
},
{
"id": "fc3a56f2bb4dda6332099eab5143fcb01b6c3bb4",
"author": {
"id": "did:key:z6MkpJ857fbgh2sRyu13owW9gVtXA3G18VeU1Yfojy4QyzCZ",
"alias": "shawn.webb"
},
"description": "Changes:\n\n- Split changes into two commits\n- Guard the `cmd_name = echo` line behind cfg to silence clippy\n- Rework `set_file_limit` into two `unix` and `windows` functions, where the\n former handles conversions to u64 and the latter i64.",
"base": "6ab3bfcba0577fabdcb84498441c6605391290f4",
"oid": "36c10fac855f5a25627f8f9b68e86bfb4800e3a4",
"timestamp": 1715170065
},
{
"id": "c344457e461a4b5d3dc1b890a22daf18e8b53ffd",
"author": {
"id": "did:key:z6MkpJ857fbgh2sRyu13owW9gVtXA3G18VeU1Yfojy4QyzCZ",
"alias": "shawn.webb"
},
"description": "Fix build on FreeBSD",
"base": "6ab3bfcba0577fabdcb84498441c6605391290f4",
"oid": "cff26ff44fad987d34044c0294da0ff4b0fa69bc",
"timestamp": 1715191369
},
{
"id": "b18a4e1ee8158e1311c810e94164aeb59794ad5b",
"author": {
"id": "did:key:z6MkpJ857fbgh2sRyu13owW9gVtXA3G18VeU1Yfojy4QyzCZ",
"alias": "shawn.webb"
},
"description": "Simplify FreeBSD/HardenedBSD support-related changes\n\nWe can simply abstract the type of integer required by the runtime.\n\nSigned-off-by:\tShawn Webb <shawn.webb@hardenedbsd.org>\nSigned-off-by:\tcloudhead <cloudhead@radicle.xyz>",
"base": "6ab3bfcba0577fabdcb84498441c6605391290f4",
"oid": "39c5172901411fb2859beeff89b61cb315ee8105",
"timestamp": 1715967475
},
{
"id": "f90dbd5443eb6dd7542cfbe8b1d78c29de842352",
"author": {
"id": "did:key:z6MkpJ857fbgh2sRyu13owW9gVtXA3G18VeU1Yfojy4QyzCZ",
"alias": "shawn.webb"
},
"description": "Rebase, squash.",
"base": "860f1dc8674bae9d92fe7311e204fe02e7bd0d88",
"oid": "d46b0b6d113ec86c8d1443c1d354ac7ce216f684",
"timestamp": 1716292152
}
]
}
}
{
"response": "triggered",
"run_id": {
"id": "e82dd0ac-f7cb-4609-bf6e-9edb9c214684"
},
"info_url": "https://cci.rad.levitte.org//e82dd0ac-f7cb-4609-bf6e-9edb9c214684.html"
}
Started at: 2026-09-08 23:46:39.761877+02:00
Commands:
$ rad clone rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 .
✓ Creating checkout in ./...
✓ Remote cloudhead@z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT added
✓ Remote-tracking branch cloudhead@z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/master created for z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT
✓ Remote fintohaps@z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM added
✓ Remote-tracking branch fintohaps@z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM/master created for z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM
✓ Remote lorenz@z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz added
✓ Remote-tracking branch lorenz@z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz/master created for z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz
✓ Repository successfully cloned under /opt/radcis/ci.rad.levitte.org/cci/state/e82dd0ac-f7cb-4609-bf6e-9edb9c214684/w/
╭────────────────────────────────────╮
│ heartwood │
│ Radicle Heartwood Protocol & Stack │
│ 189 issues · 39 patches │
╰────────────────────────────────────╯
Run `cd ./.` to go to the repository directory.
Exit code: 0
$ rad patch checkout c21654de722a541bc926ec8a9a477f896525771f
✓ Switched to branch patch/c21654d at revision b18a4e1
✓ Branch patch/c21654d setup to track rad/patches/c21654de722a541bc926ec8a9a477f896525771f
Exit code: 0
$ git config advice.detachedHead false
Exit code: 0
$ git checkout 39c5172901411fb2859beeff89b61cb315ee8105
HEAD is now at 39c51729 Simplify FreeBSD/HardenedBSD support-related changes
Exit code: 0
$ rad patch show c21654de722a541bc926ec8a9a477f896525771f -p
╭─────────────────────────────────────────────────────────────────────────────────╮
│ Title Fix build on FreeBSD/HardenedBSD │
│ Patch c21654de722a541bc926ec8a9a477f896525771f │
│ Author shawn.webb z6MkpJ8…y4QyzCZ │
│ Head 39c5172901411fb2859beeff89b61cb315ee8105 │
│ Base 6ab3bfcba0577fabdcb84498441c6605391290f4 │
│ Target master │
│ Branches patch/c21654d │
│ Commits ahead 4, behind 1374 │
│ Status merged │
│ │
│ I'm not entirely sure that the inode changes will work on Linux. But │
│ this commit fixes the Radicle build for these applications: │
│ │
│ 1. radicle-cli │
│ 2. radicle-httpd │
│ 3. radicle-node │
│ 4. radicle-remote-helper │
│ 5. radicle-tools │
│ │
│ Signed-off-by: Shawn Webb <shawn.webb@hardenedbsd.org> │
├─────────────────────────────────────────────────────────────────────────────────┤
│ 39c5172 Simplify FreeBSD/HardenedBSD support-related changes │
│ cff26ff Fix FreeBSD build │
│ 36c10fa httpd: support Windows for `rad web` │
│ 8bff6c9 radicle: OS specific setting of file limits │
├─────────────────────────────────────────────────────────────────────────────────┤
│ ● Revision c21654d @ 6ab3bfc..492b503 by shawn.webb z6MkpJ8…y4QyzCZ 2 years ago │
│ ↑ Revision fc3a56f @ 6ab3bfc..36c10fa by fintohaps z6Mkire…SQZ3voM 2 years ago │
│ ↑ Revision c344457 @ 6ab3bfc..cff26ff by shawn.webb z6MkpJ8…y4QyzCZ 2 years ago │
│ └─ ✓ accepted by fintohaps z6Mkire…SQZ3voM 2 years ago │
│ ↑ Revision b18a4e1 @ 6ab3bfc..39c5172 by shawn.webb z6MkpJ8…y4QyzCZ 2 years ago │
│ ↑ Revision f90dbd5 @ 860f1dc..d46b0b6 by cloudhead z6MksFq…bS9wzpT 2 years ago │
│ └─ ✓ merged by cloudhead z6MksFq…bS9wzpT │
╰─────────────────────────────────────────────────────────────────────────────────╯
commit 39c5172901411fb2859beeff89b61cb315ee8105
Author: cloudhead <cloudhead@radicle.xyz>
Date: Fri May 17 17:36:43 2024 +0000
Simplify FreeBSD/HardenedBSD support-related changes
We can simply abstract the type of integer required by the runtime.
Signed-off-by: Shawn Webb <shawn.webb@hardenedbsd.org>
Signed-off-by: cloudhead <cloudhead@radicle.xyz>
diff --git a/radicle/src/io.rs b/radicle/src/io.rs
index db7f8e0021..8af88728dd 100644
--- a/radicle/src/io.rs
+++ b/radicle/src/io.rs
@@ -4,53 +4,20 @@ use std::io;
use libc::{getrlimit, rlimit, setrlimit, RLIMIT_NOFILE};
#[cfg(not(target_os = "freebsd"))]
-/// Sets the open file limit to the given value, or the maximum allowed value.
-pub fn set_file_limit<N>(n: N) -> io::Result<u64>
-where
- N: Copy + fmt::Display,
- u64: TryFrom<N>,
-{
- let Ok(n) = u64::try_from(n) else {
- return Err(io::Error::new(
- io::ErrorKind::InvalidInput,
- format!("expected value that fits into u64, found: {n}"),
- ));
- };
- let mut rlim = rlimit {
- rlim_cur: 0, // Initial soft limit value
- rlim_max: 0, // Initial hard limit value
- };
- // Get the current limits.
- unsafe {
- if getrlimit(RLIMIT_NOFILE, &mut rlim) != 0 {
- return Err(io::Error::last_os_error());
- }
- }
- if rlim.rlim_cur >= n {
- return Ok(rlim.rlim_cur);
- }
- // Set the soft limit to the given value, up to the hard limit.
- rlim.rlim_cur = n.min(rlim.rlim_max);
- unsafe {
- if setrlimit(RLIMIT_NOFILE, &rlim as *const rlimit) != 0 {
- return Err(io::Error::last_os_error());
- }
- }
- Ok(rlim.rlim_cur)
-}
-
-// FreeBSD uses i64 instead of u64
+type Int = u64;
#[cfg(target_os = "freebsd")]
+type Int = i64;
+
/// Sets the open file limit to the given value, or the maximum allowed value.
-pub fn set_file_limit<N>(n: N) -> io::Result<i64>
+pub fn set_file_limit<N>(n: N) -> io::Result<Int>
where
N: Copy + fmt::Display,
- i64: TryFrom<N>,
+ Int: TryFrom<N>,
{
- let Ok(n) = i64::try_from(n) else {
+ let Ok(n) = Int::try_from(n) else {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
- format!("expected value that fits into i64, found: {n}"),
+ format!("invalid file limit '{n}'"),
));
};
let mut rlim = rlimit {
commit cff26ff44fad987d34044c0294da0ff4b0fa69bc
Author: Shawn Webb <shawn.webb@hardenedbsd.org>
Date: Wed May 8 18:02:00 2024 +0000
Fix FreeBSD build
Signed-off-by: Shawn Webb <shawn.webb@hardenedbsd.org>
diff --git a/radicle-httpd/src/commands/web.rs b/radicle-httpd/src/commands/web.rs
index 4615bff39b..01bf05ab03 100644
--- a/radicle-httpd/src/commands/web.rs
+++ b/radicle-httpd/src/commands/web.rs
@@ -192,7 +192,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
}
if options.open {
- #[cfg(target_os = "windows")]
+ #[cfg(target_os = "freebsd")]
let cmd_name = "echo";
#[cfg(target_os = "macos")]
let cmd_name = "open";
diff --git a/radicle/src/io.rs b/radicle/src/io.rs
index 11c42be045..db7f8e0021 100644
--- a/radicle/src/io.rs
+++ b/radicle/src/io.rs
@@ -3,7 +3,7 @@ use std::io;
use libc::{getrlimit, rlimit, setrlimit, RLIMIT_NOFILE};
-#[cfg(target_family = "unix")]
+#[cfg(not(target_os = "freebsd"))]
/// Sets the open file limit to the given value, or the maximum allowed value.
pub fn set_file_limit<N>(n: N) -> io::Result<u64>
where
@@ -39,15 +39,15 @@ where
Ok(rlim.rlim_cur)
}
-// N.b. windows uses i64 instead of u64
-#[cfg(target_family = "windows")]
+// FreeBSD uses i64 instead of u64
+#[cfg(target_os = "freebsd")]
/// Sets the open file limit to the given value, or the maximum allowed value.
pub fn set_file_limit<N>(n: N) -> io::Result<i64>
where
N: Copy + fmt::Display,
i64: TryFrom<N>,
{
- let Ok(n) = u64::try_from(n) else {
+ let Ok(n) = i64::try_from(n) else {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
format!("expected value that fits into i64, found: {n}"),
commit 36c10fac855f5a25627f8f9b68e86bfb4800e3a4
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Wed May 8 13:03:10 2024 +0100
httpd: support Windows for `rad web`
There was no Windows `cmd_name` support in `rad web`. In this case `echo` is
used.
Signed-off-by: Shawn Webb <shawn.webb@hardenedbsd.org>
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
diff --git a/radicle-httpd/src/commands/web.rs b/radicle-httpd/src/commands/web.rs
index 3229ebf5a1..4615bff39b 100644
--- a/radicle-httpd/src/commands/web.rs
+++ b/radicle-httpd/src/commands/web.rs
@@ -192,6 +192,8 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
}
if options.open {
+ #[cfg(target_os = "windows")]
+ let cmd_name = "echo";
#[cfg(target_os = "macos")]
let cmd_name = "open";
#[cfg(target_os = "linux")]
commit 8bff6c9405eb8dee1699feb437ea29c4dfeed18d
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Wed May 8 12:58:20 2024 +0100
radicle: OS specific setting of file limits
On Windows systems the file limits are of type `i64` in comparison to `u64` on Unix
systems.
In order to attempt both, the `set_file_limit` function is duplicated to handle
the case for i64 for Windows, and u64 for Unix. Each is guarded by its
respective `target_family`.
In order to support the `usize` configuration value, the functions are modified
to accept values that can fallibly be converted to `i64` and `u64`,
respectively. If this fails an `io::Error` is returned.
Co-authored-by: Shawn Webb <shawn.webb@hardenedbsd.org>
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
diff --git a/radicle-node/src/main.rs b/radicle-node/src/main.rs
index cc99ea94cb..af50a3d226 100644
--- a/radicle-node/src/main.rs
+++ b/radicle-node/src/main.rs
@@ -120,7 +120,7 @@ fn execute() -> anyhow::Result<()> {
config.node.listen.clone()
};
- if let Err(e) = radicle::io::set_file_limit(config.node.limits.max_open_files as u64) {
+ if let Err(e) = radicle::io::set_file_limit(config.node.limits.max_open_files) {
log::warn!(target: "node", "Unable to set process open file limit: {e}");
}
diff --git a/radicle/src/io.rs b/radicle/src/io.rs
index 86a6db7e10..11c42be045 100644
--- a/radicle/src/io.rs
+++ b/radicle/src/io.rs
@@ -1,9 +1,58 @@
+use std::fmt;
use std::io;
use libc::{getrlimit, rlimit, setrlimit, RLIMIT_NOFILE};
+#[cfg(target_family = "unix")]
/// Sets the open file limit to the given value, or the maximum allowed value.
-pub fn set_file_limit(n: u64) -> io::Result<u64> {
+pub fn set_file_limit<N>(n: N) -> io::Result<u64>
+where
+ N: Copy + fmt::Display,
+ u64: TryFrom<N>,
+{
+ let Ok(n) = u64::try_from(n) else {
+ return Err(io::Error::new(
+ io::ErrorKind::InvalidInput,
+ format!("expected value that fits into u64, found: {n}"),
+ ));
+ };
+ let mut rlim = rlimit {
+ rlim_cur: 0, // Initial soft limit value
+ rlim_max: 0, // Initial hard limit value
+ };
+ // Get the current limits.
+ unsafe {
+ if getrlimit(RLIMIT_NOFILE, &mut rlim) != 0 {
+ return Err(io::Error::last_os_error());
+ }
+ }
+ if rlim.rlim_cur >= n {
+ return Ok(rlim.rlim_cur);
+ }
+ // Set the soft limit to the given value, up to the hard limit.
+ rlim.rlim_cur = n.min(rlim.rlim_max);
+ unsafe {
+ if setrlimit(RLIMIT_NOFILE, &rlim as *const rlimit) != 0 {
+ return Err(io::Error::last_os_error());
+ }
+ }
+ Ok(rlim.rlim_cur)
+}
+
+// N.b. windows uses i64 instead of u64
+#[cfg(target_family = "windows")]
+/// Sets the open file limit to the given value, or the maximum allowed value.
+pub fn set_file_limit<N>(n: N) -> io::Result<i64>
+where
+ N: Copy + fmt::Display,
+ i64: TryFrom<N>,
+{
+ let Ok(n) = u64::try_from(n) else {
+ return Err(io::Error::new(
+ io::ErrorKind::InvalidInput,
+ format!("expected value that fits into i64, found: {n}"),
+ ));
+ };
let mut rlim = rlimit {
rlim_cur: 0, // Initial soft limit value
rlim_max: 0, // Initial hard limit value
Exit code: 0
shell: 'cargo --version rustc --version cargo fmt --check cargo clippy --all-targets --workspace -- --deny clippy::all cargo build --all-targets --workspace cargo doc --workspace cargo test --workspace --no-fail-fast '
Commands:
$ podman run --name e82dd0ac-f7cb-4609-bf6e-9edb9c214684 -v /opt/radcis/ci.rad.levitte.org/cci/state/e82dd0ac-f7cb-4609-bf6e-9edb9c214684/s:/e82dd0ac-f7cb-4609-bf6e-9edb9c214684/s:ro -v /opt/radcis/ci.rad.levitte.org/cci/state/e82dd0ac-f7cb-4609-bf6e-9edb9c214684/w:/e82dd0ac-f7cb-4609-bf6e-9edb9c214684/w -w /e82dd0ac-f7cb-4609-bf6e-9edb9c214684/w -v /opt/radcis/ci.rad.levitte.org/.radicle:/${id}/.radicle:ro -e RAD_HOME=/${id}/.radicle rust:trixie bash /e82dd0ac-f7cb-4609-bf6e-9edb9c214684/s/script.sh
+ cargo --version
info: syncing channel updates for '1.77-x86_64-unknown-linux-gnu'
info: latest update on 2024-04-09, rust version 1.77.2 (25ef9e3d8 2024-04-09)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-std'
info: installing component 'rustc'
cargo 1.77.2 (e52e36006 2024-03-26)
+ rustc --version
rustc 1.77.2 (25ef9e3d8 2024-04-09)
+ cargo fmt --check
error: 'cargo-fmt' is not installed for the toolchain '1.77-x86_64-unknown-linux-gnu'.
To install, run `rustup component add --toolchain 1.77-x86_64-unknown-linux-gnu rustfmt`
Exit code: 1
{
"response": "finished",
"result": "failure"
}