From b90dec5be37d3c9daa3790d5c5748d6323ace55a Mon Sep 17 00:00:00 2001 From: "jabber.developer2" Date: Sun, 31 May 2026 15:12:40 +0300 Subject: [PATCH] remove SIGUSR1 escape; pkill is the standard recovery The SIGUSR1 -> editor_emergency_kill wiring was a contrived escape hatch. A console user with a stuck editor reaches for kill / pkill / SIGKILL on the editor, not undocumented signals on the chat client. editor_emergency_kill() stays for the internal Ctrl-Z abort path. --- src/command/cmd_defs.c | 3 ++- src/profanity.c | 11 ----------- src/tools/editor.h | 4 +--- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 60a85eec..e3e26ddf 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -2638,7 +2638,8 @@ static const struct cmd_t command_defs[] = { CMD_DESC( "Spawn external editor to edit message. " "After editing the inputline may appear empty. Press enter to send the text anyways. " - "Use /executable to set your favourite editor." ) + "Use /executable to set your favourite editor. " + "Ctrl-Z in the editor aborts the session and returns to Profanity." ) }, { CMD_PREAMBLE("/correct-editor", diff --git a/src/profanity.c b/src/profanity.c index 2d278ba5..2d5aca43 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -20,7 +20,6 @@ #include #include -#include #include "profanity.h" #include "common.h" @@ -219,15 +218,6 @@ sigterm_handler(int sig) force_quit = TRUE; } -// SIGUSR1 escape for an alive-but-stuck editor (WUNTRACED can't catch it). -// Dispatched in the main loop. Trigger: `pkill -USR1 profanity`. -static gboolean -_emergency_resume_handler(gpointer data) -{ - editor_emergency_kill(); - return G_SOURCE_CONTINUE; -} - static void sigtstp_handler(int sig) { @@ -252,7 +242,6 @@ _init(char* log_level, char* config_file, char* log_file, char* theme_name) signal(SIGWINCH, ui_sigwinch_handler); signal(SIGTERM, sigterm_handler); signal(SIGHUP, sigterm_handler); - g_unix_signal_add(SIGUSR1, _emergency_resume_handler, NULL); if (pthread_mutex_init(&lock, NULL) != 0) { log_error("Mutex init failed"); exit(1); diff --git a/src/tools/editor.h b/src/tools/editor.h index 51e912ed..9be51a6f 100644 --- a/src/tools/editor.h +++ b/src/tools/editor.h @@ -16,9 +16,7 @@ gboolean launch_editor(gchar* initial_content, void (*callback)(gchar* content, void* data), void* user_data); -// SIGUSR1 escape: SIGTERM the editor child. Use when WUNTRACED can't catch -// it (alive but stuck). Wired in profanity.c. -void editor_emergency_kill(void); +void editor_emergency_kill(void); // SIGCONT+SIGTERM the editor child // TRUE if editor child is STOPPED (Ctrl-Z / :stop / gdb-attach). Does not // reap; g_child_watch keeps handling exit.