aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-08-17 22:45:45 +0200
committerChristian Clason <c.clason@uni-graz.at>2024-08-18 01:19:01 +0200
commitd1bdeacb00186ba72fa61f3c7f2951fd018ae21d (patch)
tree4794bcb34dc0ae75b877c31d2327b44174d97046
parentcce1eb0806cc8c2f75b60aee5841b4750c2258c1 (diff)
downloadrneovim-d1bdeacb00186ba72fa61f3c7f2951fd018ae21d.tar.gz
rneovim-d1bdeacb00186ba72fa61f3c7f2951fd018ae21d.tar.bz2
rneovim-d1bdeacb00186ba72fa61f3c7f2951fd018ae21d.zip
vim-patch:8e25d91: runtime(dist): verify that executable is in $PATH
Otherwise, if the executable to be verified does not exist, this would cause a false-positive in the 'IsSafeExecutable()' check, because 'exepath(executable)' returns an empty string and 'fnamemodify('', ':p:h')' returns the current directory and as a result the 'IsSafeExecutable()' returns false (for the wrong reason). https://github.com/vim/vim/commit/8e25d91cb7bb4dc171cb4e95b1bb79a39400a13a Co-authored-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--runtime/autoload/dist/vim.vim4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/autoload/dist/vim.vim b/runtime/autoload/dist/vim.vim
index 021244c93b..d519406530 100644
--- a/runtime/autoload/dist/vim.vim
+++ b/runtime/autoload/dist/vim.vim
@@ -18,6 +18,10 @@ endif
if !has('vim9script')
function dist#vim#IsSafeExecutable(filetype, executable)
let cwd = getcwd()
+ if empty(exepath(a:executable))
+ echomsg a:executable .. " not found in $PATH"
+ return v:false
+ endif
return get(g:, a:filetype .. '_exec', get(g:, 'plugin_exec', 0)) &&
\ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd
\ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 &&