From adff3f4dee5e1ab374015fa47676a526099b8a67 Mon Sep 17 00:00:00 2001 From: Abdelhakeem Date: Tue, 26 Mar 2019 18:17:19 +0200 Subject: [PATCH] vim-patch:8.1.0539: cannot build without the sandbox Problem: Cannot build without the sandbox. Solution: Set the secure option instead of using the sandbox. Also restrict the characters from 'spelllang' that are used for LANG.vim. (suggested by Yasuhiro Matsumoto) https://github.com/vim/vim/commit/82e8c92ebef5afcac0c0fdb706ff163f9b3366f7 --- runtime/doc/options.txt | 2 +- src/nvim/buffer.c | 4 ++-- src/nvim/option.c | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 534b2025cd..b9eea75e5c 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5527,7 +5527,7 @@ A jump table for the options with a short description can be found at |Q_op|. After this option has been set successfully, Vim will source the files "spell/LANG.vim" in 'runtimepath'. "LANG" is the value of 'spelllang' - up to the first comma, dot or underscore. + up to the first character that is not an ASCII letter and not a dash. Also see |set-spc-auto|. diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index e9be0b4c42..ac07af7baa 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -4927,11 +4927,11 @@ chk_modeline ( save_SID = current_SID; current_SID = SID_MODELINE; // Make sure no risky things are executed as a side effect. - sandbox++; + ++secure; retval = do_set(s, OPT_MODELINE | OPT_LOCAL | flags); - sandbox--; + --secure; current_SID = save_SID; if (retval == FAIL) /* stop if error found */ break; diff --git a/src/nvim/option.c b/src/nvim/option.c index a09bd2915d..ef6e71daec 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -3291,11 +3291,13 @@ did_set_string_option ( * '.encoding'. */ for (p = q; *p != NUL; ++p) - if (vim_strchr((char_u *)"_.,", *p) != NULL) + if (!ASCII_ISALPHA(*p) && *p != '-') break; - vim_snprintf((char *)fname, sizeof(fname), "spell/%.*s.vim", - (int)(p - q), q); - source_runtime(fname, DIP_ALL); + if (p > q) { + vim_snprintf((char *)fname, sizeof(fname), "spell/%.*s.vim", + (int)(p - q), q); + source_runtime(fname, DIP_ALL); + } } }