mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	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).
8e25d91cb7
Co-authored-by: Christian Brabandt <cb@256bit.org>
			
			
This commit is contained in:
		
							
								
								
									
										4
									
								
								runtime/autoload/dist/vim.vim
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								runtime/autoload/dist/vim.vim
									
									
									
									
										vendored
									
									
								
							| @@ -18,6 +18,10 @@ endif | |||||||
| if !has('vim9script') | if !has('vim9script') | ||||||
|   function dist#vim#IsSafeExecutable(filetype, executable) |   function dist#vim#IsSafeExecutable(filetype, executable) | ||||||
|     let cwd = getcwd() |     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)) && |     return get(g:, a:filetype .. '_exec', get(g:, 'plugin_exec', 0)) && | ||||||
|           \ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd |           \ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd | ||||||
|           \ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 && |           \ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 && | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Christian Clason
					Christian Clason