From 9857dc685a69bc3796f5f715e450222935251235 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 17 Jul 2026 12:33:49 +0200 Subject: [PATCH] Don't report SIGQUIT to Sentry SIGQUIT is a user-initiated "quit with core dump" action (e.g. pressing Ctrl-\ at a terminal), not a crash, but crashpad includes it in its set of handled signals, so it got uploaded to Sentry as a fatal error. For example, we received crash reports of nix sitting in the blocking stdin read at the flake nixConfig trust prompt when the user pressed Ctrl-\. Fix this by resetting SIGQUIT to its default disposition in initNix(), which runs after sentry_init() has installed the crashpad handlers. We already did this on macOS; now it's done on all platforms. Assisted-by: Claude Fable 5 --- src/libmain/shared.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index ef26c50a58fc..62fd0a41f84e 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -175,6 +175,15 @@ void initNix(bool loadConfig) act.sa_handler = sigHandler; if (sigaction(SIGUSR1, &act, 0)) throw SysError("handling SIGUSR1"); + + /* Reset SIGQUIT to its default disposition. In particular, this + unregisters any crash handler installed by `sentry_init()` + (which runs before us): SIGQUIT is a user-initiated "quit with + core dump" action (e.g. Ctrl-\ at a terminal), not a crash, so + it should not be reported. */ + act.sa_handler = SIG_DFL; + if (sigaction(SIGQUIT, &act, 0)) + throw SysError("handling SIGQUIT"); #endif #ifdef __APPLE__ @@ -198,8 +207,6 @@ void initNix(bool loadConfig) throw SysError("handling SIGHUP"); if (sigaction(SIGPIPE, &act, 0)) throw SysError("handling SIGPIPE"); - if (sigaction(SIGQUIT, &act, 0)) - throw SysError("handling SIGQUIT"); if (sigaction(SIGTRAP, &act, 0)) throw SysError("handling SIGTRAP"); #endif