patch 9.1.0264: libgpm may delete some signal handlers Commit: https://github.com/vim/vim/commit/cc59d62215b075c715294ad24a41bfd091cb8d48 Author: Julio B <julio.ba...@gmail.com> Date: Thu Apr 4 21:55:10 2024 +0200
patch 9.1.0264: libgpm may delete some signal handlers Problem: libgpm may delete some signal handlers Solution: restore these signal handlers after calling gpm (Julio B) When 'mouse' is set, vim is trying to detect mouse support on startup. Eventually, vim resorts to using libgpm as the final method of mouse detection. This library may delete some signals handlers that were initially set up by vim. This is how: - mch_setmouse() calls gpm_open() - Gpm_Open is executed, which returns early on line 210 [1] - Keep in mind that lines 353-373 [2] are skipped, so gpm_saved_suspend_hook and gpm_saved_winch_hook are empty - Finally, Gpm_Close is called, which will reset [3] SIGWINCH and SIGTSTP to an empty sigaction. [1] https://github.com/telmich/gpm/blob/e82d1a653ca94aa4ed12441424da6ce780b1e530/src/lib/liblow.c#L210 [2] https://github.com/telmich/gpm/blob/e82d1a653ca94aa4ed12441424da6ce780b1e530/src/lib/liblow.c#L353-L373 [3] https://github.com/telmich/gpm/blob/e82d1a653ca94aa4ed12441424da6ce780b1e530/src/lib/liblow.c#L419-L424 fixes: #12154 closes: #14401 Signed-off-by: Julio B <julio.ba...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/os_unix.c b/src/os_unix.c index e98911e0f..da7f56a67 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -7494,7 +7494,19 @@ gpm_open(void) return 1; // succeed } if (gpm_fd == -2) + { Gpm_Close(); // We don't want to talk to xterm via gpm + + // Gpm_Close fails to properly restore the WINCH and TSTP handlers, + // leading to Vim ignoring resize signals. We have to re-initialize + // these handlers again here. +# ifdef SIGWINCH + mch_signal(SIGWINCH, sig_winch); +# endif +# ifdef SIGTSTP + mch_signal(SIGTSTP, restricted ? SIG_IGN : sig_tstp); +# endif + } return 0; } diff --git a/src/version.c b/src/version.c index 1a82d9b3a..861adf1bd 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 264, /**/ 263, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1rsTFm-008VM5-Te%40256bit.org.