Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Zdenek Dohnal
a83ea2099a testing, reported upstream with patch: use sysconf() for SIGSTKSZ 2021-02-24 13:01:04 +01:00
2 changed files with 87 additions and 1 deletions

81
vim-sigaltstack.patch Normal file
View file

@ -0,0 +1,81 @@
diff --git a/src/config.h.in b/src/config.h.in
index 1b01633..9657556 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -497,6 +497,9 @@
/* Define to inline symbol or empty */
#undef inline
+/* Define if _SC_SIGSTKSZ is available via sysconf() */
+#undef HAVE_SYSCONF_SIGSTKSZ
+
/* Do we need FIPS warning? */
#undef HAVE_FIPS_WARNING
diff --git a/src/configure.ac b/src/configure.ac
index aba4e1b..8a14a55 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -4137,6 +4137,15 @@ AC_TRY_COMPILE(
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 <unistd.h>],
+[ (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])
diff --git a/src/os_unix.c b/src/os_unix.c
index 1edc7e6..fe12aba 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -783,7 +783,7 @@ mch_stackcheck(char *p)
* completely full.
*/
-#ifndef SIGSTKSZ
+#if !defined SIGSTKSZ && !defined(HAVE_SYSCONF_SIGSTKSZ)
# define SIGSTKSZ 8000 // just a guess of how much stack is needed...
#endif
@@ -806,13 +806,21 @@ init_signal_stack(void)
# 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,7 +3269,11 @@ mch_early_init(void)
* 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
}

View file

@ -21,7 +21,7 @@ Summary: The VIM editor
URL: http://www.vim.org/
Name: vim
Version: %{baseversion}.%{patchlevel}
Release: 1%{?dist}
Release: 2%{?dist}
License: Vim and MIT
Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2
Source1: virc
@ -64,6 +64,7 @@ Patch3016: vim-8.0-copy-paste.patch
Patch3017: vim-python3-tests.patch
# fips warning
Patch3018: vim-crypto-warning.patch
Patch3019: vim-sigaltstack.patch
# gcc is no longer in buildroot by default
BuildRequires: gcc
@ -270,6 +271,7 @@ perl -pi -e "s,bin/nawk,bin/awk,g" runtime/tools/mve.awk
%patch3016 -p1 -b .copypaste
%patch3017 -p1 -b .python-tests
%patch3018 -p1
%patch3019 -p1 -b .sigaltstack
%build
cd src
@ -820,6 +822,9 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%config(noreplace) %{_sysconfdir}/profile.d/vim-default-editor.*
%changelog
* Wed Feb 24 2021 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.2541-2
- rebuilt
* Mon Feb 22 2021 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.2541-1
- patchlevel 2541
- 1931099 - Build version numbers don't match the actual build patchlevel