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>
runtime(dist): Make dist/vim.vim work properly when lacking vim9script support (vim/vim#13487)
`:return` cannot be used outside of `:function` (or `:def`) in older Vims
lacking Vim9script support or in Neovim, even when evaluation is being skipped
in the dead `:else` branch.
Instead, use the pattern described in `:h vim9-mix`, which uses `:finish` to end
script processing before it reaches the vim9script stuff.
b2a4c110a5
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
runtime(dist): add legacy version for central vim library
Also, enable the zip and gzip plugins by default, unless those variables
were not explicitly set by the user.
related: vim/vim#134134f174f0de9
Co-authored-by: Christian Brabandt <cb@256bit.org>
runtime(dist): centralize safe executable check and add vim library (vim/vim#13413)
Follow up to 816fbcc26 (patch 9.0.1833: [security] runtime file fixes,
2023-08-31) and f7ac0ef50 (runtime: don't execute external commands when
loading ftplugins, 2023-09-06).
This puts the logic for safe executable checks in a single place, by introducing
a central vim library, so all filetypes benefit from consistency.
Notable changes:
- dist#vim because the (autoload) namespace for a new runtime support
library. Supporting functions should get documentation. It might make
life easier for NeoVim devs to make the documentation a new file
rather than cram it into existing files, though we may want
cross-references to it somewhere…
- The gzip and zip plugins need to be opted into by enabling execution
of those programs (or the global plugin_exec). This needs
documentation or discussion.
- This fixes a bug in the zig plugin: code setting s:tmp_cwd was removed
in f7ac0ef50 (runtime: don't execute external commands when loading
ftplugins, 2023-09-06), but the variable was still referenced. Since
the new function takes care of that automatically, the variable is no
longer needed.
cd8a3eaf53
Co-authored-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Made obsolete by now graduated `filetype.lua` (enabled by default).
Note that changes or additions to the filetype detection still need to
be made through a PR to vim/vim as we port the _logic_ as well as tests.
vim-patch:9.0.0771: cannot always tell the difference beween tex and rexx files
Problem: Cannot always tell the difference beween tex and rexx files.
Solution: Recognize tex by a leading backslash. (Martin Tournoij,
closesvim/vim#11380)
bd053f894b
vim-patch:9.0.0055: bitbake files are not detected
Problem: Bitbake files are not detected.
Solution: Add bitbake filetype detection by file name and contents. (Gregory
Anders, closesvim/vim#10697)
fa49eb4827
Problem: KRL files using "deffct" not recognized.
Solution: Adjust the pattern used for matching. (Patrick Meiser-Knosowski,
closesvim/vim#10200)
93c7a45e86
Problem: Supercollider filetype not recognized.
Solution: Match file extentions and check file contents to detect
supercollider. (closesvim/vim#10142)
8cac20ed42
Problem: Kuka Robot Language files not recognized.
Solution: Recognize *.src and *.dat files. (Patrick Meiser-Knosowski,
closesvim/vim#10096)
3ad2090316
Problem: Dtrace files are recognized as filetype D.
Solution: Add a pattern for Dtrace files. (Teubel György, closesvim/vim#9841)
Add some more testing.
4d56b971cb
Problem: Basic and form filetype detection is incomplete.
Solution: Add a separate function for .frm files. (Doug Kearns, closesvim/vim#9675)
c570e9cf68
* vim-patch:8.2.4064: foam files are not detected
Problem: Foam files are not detected.
Solution: Detect the foam filetype by the path and file contents. (Mohammed
Elwardi Fadeli, closesvim/vim#9501)
2284f6cca3
* Port foam ft detection to filetype.lua
Co-authored-by: Gregory Anders <greg@gpanders.com>
Problem: Dep3patch files are not recognized.
Solution: Recognize dep3patch files by their location and content. (James
McCoy, closesvim/vim#9367)
647ab4cede