From 1aae46422242677c6cc23438537b70444436e5ce Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 3 Oct 2019 02:52:15 -0400 Subject: vim-patch:8.1.2115: MS-Windows: shell commands fail if &shell contains a space Problem: MS-Windows: shell commands fail if &shell contains a space. Solution: Use quotes instead of escaping. (closes vim/vim#4920) https://github.com/vim/vim/commit/2efc44b3f0b6bd8307cb281af095e08e15ab1c24 Always double-quote &shell if it contains a space. Neovim does not support escaping space with backslash, unlike Vim. N/A patches for version.c: vim-patch:8.0.1455: if $SHELL contains a space then 'shell' is incorrect Problem: If $SHELL contains a space then the default value of 'shell' is incorrect. (Matthew Horan) Solution: Escape spaces in $SHELL. (Christian Brabandt, closes vim/vim#459) https://github.com/vim/vim/commit/4bfa8af14142e54f509048239f4e8596911f56aa vim-patch:8.2.1194: test failure because shell prompt differs Problem: Test failure because shell prompt differs. Solution: Set the shell prompt. https://github.com/vim/vim/commit/a4dc6f92bb29b00783f8945bbe1101e837b6ad3c --- src/nvim/option.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/nvim/option.c') diff --git a/src/nvim/option.c b/src/nvim/option.c index 146bce8cc0..6149331763 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -652,7 +652,14 @@ void set_init_1(bool clean_arg) { const char *shell = os_getenv("SHELL"); if (shell != NULL) { - set_string_default("sh", (char *) shell, false); + if (vim_strchr((const char_u *)shell, ' ') != NULL) { + const size_t len = strlen(shell) + 3; // two quotes and a trailing NUL + char *const cmd = xmalloc(len); + snprintf(cmd, len, "\"%s\"", shell); + set_string_default("sh", cmd, true); + } else { + set_string_default("sh", (char *)shell, false); + } } } @@ -987,10 +994,9 @@ static void set_string_default(const char *name, char *val, bool allocated) xfree(options[opt_idx].def_val[VI_DEFAULT]); } - options[opt_idx].def_val[VI_DEFAULT] = (char_u *) ( - allocated - ? (char_u *) val - : (char_u *) xstrdup(val)); + options[opt_idx].def_val[VI_DEFAULT] = allocated + ? (char_u *)val + : (char_u *)xstrdup(val); options[opt_idx].flags |= P_DEF_ALLOCED; } } -- cgit