From 4c7656a5c3e85e89bb0490e8f42eef27e8783bcd Mon Sep 17 00:00:00 2001 From: Red Bear OS Date: Sun, 26 Jul 2026 17:40:06 +0900 Subject: [PATCH] init: replace .expect("TODO") on namespace registration with descriptive panic messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The scheme-service boot path in service.rs used .expect("TODO") on two boot-critical libredox calls: - libredox::call::getns() — gets a fd to the current namespace - libredox::call::register_scheme_to_ns() — registers the spawned scheme into that namespace If either call fails the scheme is invisible, which is non-recoverable for boot. The placeholder "TODO" message gave no diagnostic value. Replaced with descriptive messages: - getns: .expect("init: failed to get current namespace fd; ...") - register_scheme: unwrap_or_else(|e| panic!(...)) including the scheme name and the error, matching the existing pattern at line 87 (create_pipe unwrap_or_else). No behaviour change — both paths still panic on failure. The only difference is that the panic message now identifies the failure and includes the offending scheme name. --- init/src/service.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/init/src/service.rs b/init/src/service.rs index 2646da7f46..6eb2242493 100644 --- a/init/src/service.rs +++ b/init/src/service.rs @@ -137,9 +137,15 @@ impl Service { } } - let current_namespace_fd = libredox::call::getns().expect("TODO"); + let current_namespace_fd = libredox::call::getns() + .expect("init: failed to get current namespace fd; boot cannot continue"); libredox::call::register_scheme_to_ns(current_namespace_fd, scheme, new_fd) - .expect("TODO"); + .unwrap_or_else(|e| { + panic!( + "init: failed to register scheme '{}' in namespace: {}; boot cannot continue", + scheme, e + ) + }); } ServiceType::Oneshot => { drop(read_pipe);