To: vim_dev@googlegroups.com Subject: Patch 8.2.2550 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2550 Problem: Signal stack size is wrong with latest glibc 2.34. Solution: Use sysconf(_SC_SIGSTKSZ) if available. (Zdenek Dohnal, closes #7895) Files: src/config.h.in, src/configure.ac, src/os_unix.c, src/auto/configure *** ../vim-8.2.2549/src/config.h.in 2020-06-16 20:03:38.743351051 +0200 --- src/config.h.in 2021-02-25 16:50:02.084219523 +0100 *************** *** 496,498 **** --- 496,501 ---- /* Define to inline symbol or empty */ #undef inline + + /* Define if _SC_SIGSTKSZ is available via sysconf() */ + #undef HAVE_SYSCONF_SIGSTKSZ *** ../vim-8.2.2549/src/configure.ac 2021-01-31 19:52:46.617940870 +0100 --- src/configure.ac 2021-02-25 16:50:02.088219508 +0100 *************** *** 4105,4110 **** --- 4105,4119 ---- AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF), AC_MSG_RESULT(not usable)) + dnl check if we have _SC_SIGSTKSZ via sysconf() + AC_MSG_CHECKING(for _SC_SIGSTKSZ via sysconf()) + AC_TRY_COMPILE( + [#include ], + [ (void)sysconf(_SC_SIGSTKSZ); + ], + AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF_SIGSTKSZ), + AC_MSG_RESULT(not usable)) + AC_CHECK_SIZEOF([int]) AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([time_t]) *** ../vim-8.2.2549/src/os_unix.c 2020-12-08 19:18:33.446080241 +0100 --- src/os_unix.c 2021-02-25 16:50:02.088219508 +0100 *************** *** 783,789 **** * completely full. */ ! #ifndef SIGSTKSZ # define SIGSTKSZ 8000 // just a guess of how much stack is needed... #endif --- 783,789 ---- * completely full. */ ! #if !defined SIGSTKSZ && !defined(HAVE_SYSCONF_SIGSTKSZ) # define SIGSTKSZ 8000 // just a guess of how much stack is needed... #endif *************** *** 806,818 **** --- 806,826 ---- # else sigstk.ss_sp = signal_stack; # endif + # ifdef HAVE_SYSCONF_SIGSTKSZ + sigstk.ss_size = sysconf(_SC_SIGSTKSZ); + # else sigstk.ss_size = SIGSTKSZ; + # endif sigstk.ss_flags = 0; (void)sigaltstack(&sigstk, NULL); # else sigstk.ss_sp = signal_stack; if (stack_grows_downwards) + # ifdef HAVE_SYSCONF_SIGSTKSZ + sigstk.ss_sp += sysconf(_SC_SIGSTKSZ) - 1; + # else sigstk.ss_sp += SIGSTKSZ - 1; + # endif sigstk.ss_onstack = 0; (void)sigstack(&sigstk, NULL); # endif *************** *** 3261,3267 **** --- 3269,3279 ---- * Ignore any errors. */ #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK) + # ifdef HAVE_SYSCONF_SIGSTKSZ + signal_stack = alloc(sysconf(_SC_SIGSTKSZ)); + # else signal_stack = alloc(SIGSTKSZ); + # endif init_signal_stack(); #endif } *** ../vim-8.2.2549/src/auto/configure 2021-01-31 19:52:46.617940870 +0100 --- src/auto/configure 2021-02-25 17:11:26.890781802 +0100 *************** *** 13943,13948 **** --- 13943,13972 ---- fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _SC_SIGSTKSZ via sysconf()" >&5 + $as_echo_n "checking for _SC_SIGSTKSZ via sysconf()... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include + int + main () + { + (void)sysconf(_SC_SIGSTKSZ); + + ; + return 0; + } + _ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + $as_echo "yes" >&6; }; $as_echo "#define HAVE_SYSCONF_SIGSTKSZ 1" >>confdefs.h + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not usable" >&5 + $as_echo "not usable" >&6; } + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. *** ../vim-8.2.2549/src/version.c 2021-02-24 12:27:25.439824589 +0100 --- src/version.c 2021-02-25 17:06:52.591936425 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2550, /**/ -- BRIDGEKEEPER: What is your favorite editor? GAWAIN: Emacs ... No, Viiiiiiiiiiimmmmmmm! "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///