From e46061212035fcb5b9e0737234ae40062a74c3f2 Mon Sep 17 00:00:00 2001 From: vasilito Date: Thu, 18 Jun 2026 10:44:40 +0300 Subject: [PATCH] fix(base): drop my P0-daemon-schemedaemon-option-unwrap.patch (was wrong state) The previous commit (d86bcb24a) added this patch which assumed a different state of daemon/src/lib.rs than what P0-daemon-fix-init-notify-unwrap.patch produces. The original P0-daemon-fix-init-notify-unwrap.patch ALREADY fixes the same lines using a proper closure: unsafe { get_fd("INIT_NOTIFY").map(|fd| io::PipeWriter::from_raw_fd(fd)) } vs my (broken) version: unsafe { get_fd("INIT_NOTIFY").map(io::PipeWriter::from_raw_fd) } The original uses a closure which makes the unsafe call syntactically valid. My version passes the function directly which Rust 2024 rejects because from_raw_fd is unsafe fn. Removing the redundant patch and relying on P0-daemon-fix-init-notify-unwrap which is already in the recipe. --- ...P0-daemon-schemedaemon-option-unwrap.patch | 33 ------------------- recipes/core/base/recipe.toml | 1 - 2 files changed, 34 deletions(-) delete mode 100644 local/patches/base/P0-daemon-schemedaemon-option-unwrap.patch diff --git a/local/patches/base/P0-daemon-schemedaemon-option-unwrap.patch b/local/patches/base/P0-daemon-schemedaemon-option-unwrap.patch deleted file mode 100644 index 6b9a21d9c0..0000000000 --- a/local/patches/base/P0-daemon-schemedaemon-option-unwrap.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs -index 9f507221..38752abc 100644 ---- a/daemon/src/lib.rs -+++ b/daemon/src/lib.rs -@@ -83,21 +83,25 @@ impl Daemon { - /// A long running background process that handles requests using schemes. - #[must_use = "SchemeDaemon::ready must be called"] - pub struct SchemeDaemon { -- write_pipe: PipeWriter, -+ write_pipe: Option, - } - - impl SchemeDaemon { - /// Create a new daemon for use with schemes. - pub fn new(f: impl FnOnce(SchemeDaemon) -> !) -> ! { -- let write_pipe = unsafe { io::PipeWriter::from_raw_fd(get_fd("INIT_NOTIFY")) }; -+ let write_pipe = unsafe { get_fd("INIT_NOTIFY").map(io::PipeWriter::from_raw_fd) }; - - f(SchemeDaemon { write_pipe }) - } - - /// Notify the process that the scheme daemon is ready to accept requests. - pub fn ready_with_fd(self, cap_fd: Fd) -> syscall::Result<()> { -+ let write_pipe = match self.write_pipe { -+ Some(pipe) => pipe, -+ None => return Ok(()), -+ }; - syscall::call_wo( -- self.write_pipe.as_raw_fd() as usize, -+ write_pipe.as_raw_fd() as usize, - &cap_fd.into_raw().to_ne_bytes(), - syscall::CallFlags::FD, - &[], diff --git a/recipes/core/base/recipe.toml b/recipes/core/base/recipe.toml index d3de79d3e5..70a9daa3b2 100644 --- a/recipes/core/base/recipe.toml +++ b/recipes/core/base/recipe.toml @@ -2,7 +2,6 @@ git = "https://gitlab.redox-os.org/redox-os/base.git" rev = "463f76b9608a896e6f6c9f63457f57f6409873c7" patches = [ - "P0-daemon-schemedaemon-option-unwrap.patch", "P0-redox-scheme-bump-0.11.1.patch", "P0-add-missing-driver-members.patch", "P0-init-continuous-scheduling.patch",