-*version9.txt* For Vim version 9.2. Last change: 2026 Mar 17
+*version9.txt* For Vim version 9.2. Last change: 2026 Mar 18
VIM REFERENCE MANUAL by Bram Moolenaar
Using external diff mode or setting environment variables is no longer allowed
when Vim is running in |restricted-mode|.
+Using |:cscope| is no longer allowed.
+
Other ~
-----
- The new |xdg.vim| script for full XDG compatibility is included.
call delete('XResult_env')
endfunc
+func Test_restricted_grep()
+ CheckScreendump
+
+ let lines =<< trim END
+ let result = 'okay'
+ try
+ " Try to use grep to execute an external command
+ grep 'Vim' ./*.vim
+ catch /^Vim\%((\S\+)\)\=:E145:/
+ let result = 'grep-blocked'
+ endtry
+ call writefile([result], 'XResult_grep')
+ qa!
+ END
+
+ call writefile(lines, 'Xrestricted_grep', 'D')
+ if RunVim([], [], '-Z --clean -S Xrestricted_grep')
+ call assert_equal(['grep-blocked'], readfile('XResult_grep'))
+ endif
+ call delete('XResult_grep')
+endfunc
+
+func Test_restricted_cscope()
+ CheckFeature cscope
+
+ " File does not exist, but shouldn't matter, it must be disallowed
+ let lines =<< trim END
+ let result = 'okay'
+ try
+ cscope add Xfoobar.out
+ catch /^Vim\%((\S\+)\)\=:E145:/
+ let result = 'blocked'
+ endtry
+ call writefile([result], 'XResult_cscope')
+ qa!
+ END
+
+ call writefile(lines, 'Xrestricted_cscope', 'D')
+ if RunVim([], [], '-Z --clean -S Xrestricted_cscope')
+ call assert_equal(['blocked'], readfile('XResult_cscope'))
+ endif
+ call delete('XResult_cscope')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab