{"record":{"id":"88d24adeeaa347b6","repo":"uutils/coreutils","slug":"disabling-rust-signal-handlers-failed","errorCode":null,"errorMessage":"Disabling rust signal handlers failed","messagePattern":"Disabling rust signal handlers failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/uucore_procs/src/lib.rs","lineNumber":53,"sourceCode":"        // before main() to capture whether SIGPIPE was ignored by the parent process.\n        #[cfg(all(#signals, unix, not(any(target_os = \"fuchsia\", target_os = \"haiku\"))))]\n        uucore::init_startup_state_capture!();\n\n        pub fn uumain(args: impl uucore::Args) -> i32 {\n            #stream\n\n            // Restore SIGPIPE to default if it wasn't explicitly ignored by parent.\n            // The Rust runtime ignores SIGPIPE, but we need to respect the parent's\n            // signal disposition for proper pipeline behavior (GNU compatibility).\n            // needed even for true --version\n            #[cfg(all(unix, not(any(target_os = \"fuchsia\", target_os = \"haiku\"))))]\n            if !uucore::signals::sigpipe_was_ignored() {\n                let _ = uucore::signals::enable_pipe_errors();\n            }\n\n            // disable rust signal handlers (otherwise processes don't dump core after e.g. one SIGSEGV)\n            #[cfg(all(#signals, unix))]\n            uucore::disable_rust_signal_handlers().expect(\"Disabling rust signal handlers failed\");\n            let result = uumain(args);\n            match result {\n                Ok(()) => uucore::error::get_exit_code(),\n                Err(e) => {\n                    let s = format!(\"{e}\");\n                    if s != \"\" {\n                        uucore::show_error!(\"{s}\");\n                    }\n                    if e.usage() {\n                        use std::io::{stderr, Write as _};\n                        let _ = writeln!(stderr(),\"Try '{} --help' for more information.\", uucore::execution_phrase());\n                    }\n                    e.code()\n                }\n            }\n        }\n    );\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/uutils/coreutils/blob/92995feca29e324a7c559ede91db81c32d9f5d59/src/uucore_procs/src/lib.rs#L35-L71","documentation":"The uucore proc-macro generated main calls uucore::disable_rust_signal_handlers() and unwraps with the panic message 'Disabling rust signal handlers failed'. This ensures the Rust runtime's default SIGSEGV/SIGABRT handlers (which prevent core dumps) are removed so processes dump core like GNU coreutils.","triggerScenarios":"Running any utility built with the `signals` feature on unix where disable_rust_signal_handlers returns Err — e.g. the runtime failed to reset a signal handler (sigaction failure) at startup.","commonSituations":"Restricted environments (seccomp/SELinux profiles, containers) blocking signal syscalls; exotic unix platforms where the handler-reset call fails.","solutions":["Check environment restrictions (seccomp/SELinux) that block sigaction and relax them","If core dumps are unnecessary, build without the `signals` feature so the call is compiled out","Inspect disable_rust_signal_handlers' underlying error to identify the failing signal"],"exampleFix":"// before\nuucore::disable_rust_signal_handlers().expect(\"Disabling rust signal handlers failed\");\n// after\nif let Err(e) = uucore::disable_rust_signal_handlers() { eprintln!(\"warning: {e}\"); }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// in your own bootstrap, avoid expect:\nif let Err(e) = uucore::disable_rust_signal_handlers() {\n    eprintln!(\"warning: could not disable rust signal handlers: {e}\");\n}","preventionTips":["Test utilities inside the same container/seccomp profile used in production","Enable core dumps (ulimit -c) to notice handler issues early","Build without the `signals` feature if signal-handler manipulation is not required"],"tags":["unix","signals","panic","core-dump"],"backgroundTag":"unsupported-platform","analyzedSha":"92995feca29e324a7c559ede91db81c32d9f5d59","analyzedAt":"2026-09-20T12:39:35.476Z","contentChangedAt":"2026-09-20T12:39:35.476Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}