Patch 8.2.2623

3 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 19, 2021, 9:38:47 AM3/19/21
to vim...@googlegroups.com

Patch 8.2.2623
Problem: Some tests fail when run as root.
Solution: Use CheckNotRoot.
Files: src/testdir/test_edit.vim, src/testdir/test_excmd.vim,
src/testdir/test_help.vim, src/testdir/test_writefile.vim


*** ../vim-8.2.2622/src/testdir/test_edit.vim 2021-03-05 20:47:39.793723714 +0100
--- src/testdir/test_edit.vim 2021-03-19 14:03:34.017609999 +0100
***************
*** 1704,1712 ****
endfunc

" Test for editing a file without read permission
- " NOTE: if you run tests as root this will fail. Don't run tests as root!
func Test_edit_file_no_read_perm()
CheckUnix
call writefile(['one', 'two'], 'Xfile')
call setfperm('Xfile', '-w-------')
new
--- 1704,1713 ----
endfunc

" Test for editing a file without read permission
func Test_edit_file_no_read_perm()
CheckUnix
+ CheckNotRoot
+
call writefile(['one', 'two'], 'Xfile')
call setfperm('Xfile', '-w-------')
new
*** ../vim-8.2.2622/src/testdir/test_excmd.vim 2021-03-05 20:47:39.793723714 +0100
--- src/testdir/test_excmd.vim 2021-03-19 14:05:42.721341228 +0100
***************
*** 350,362 ****
call assert_fails('redir > Xdir', 'E17:')
call delete('Xdir', 'd')
endif
- if !has('bsd')
- " Redirecting to a read-only file
- call writefile([], 'Xfile')
- call setfperm('Xfile', 'r--r--r--')
- call assert_fails('redir! > Xfile', 'E190:')
- call delete('Xfile')
- endif

" Test for redirecting to a register
redir @q> | echon 'clean ' | redir END
--- 350,355 ----
***************
*** 369,374 ****
--- 362,378 ----
call assert_equal('blue sky', color)
endfunc

+ func Test_redir_cmd_readonly()
+ CheckNotRoot
+ CheckNotBSD
+
+ " Redirecting to a read-only file
+ call writefile([], 'Xfile')
+ call setfperm('Xfile', 'r--r--r--')
+ call assert_fails('redir! > Xfile', 'E190:')
+ call delete('Xfile')
+ endfunc
+
" Test for the :filetype command
func Test_filetype_cmd()
call assert_fails('filetype abc', 'E475:')
*** ../vim-8.2.2622/src/testdir/test_help.vim 2021-03-05 20:47:39.793723714 +0100
--- src/testdir/test_help.vim 2021-03-19 14:20:35.471466493 +0100
***************
*** 1,5 ****
--- 1,7 ----
" Tests for :help

+ source check.vim
+
func Test_help_restore_snapshot()
help
set buftype=
***************
*** 88,116 ****
call assert_equal(["help-tags\ttags\t1"], readfile('Xdir/tags'))
call delete('Xdir/tags')

- " The following tests fail on FreeBSD for some reason
- if has('unix') && !has('bsd')
- " Read-only tags file
- call mkdir('Xdir/doc', 'p')
- call writefile([''], 'Xdir/doc/tags')
- call writefile([], 'Xdir/doc/sample.txt')
- call setfperm('Xdir/doc/tags', 'r-xr--r--')
- call assert_fails('helptags Xdir/doc', 'E152:', getfperm('Xdir/doc/tags'))
-
- let rtp = &rtp
- let &rtp = 'Xdir'
- helptags ALL
- let &rtp = rtp
-
- call delete('Xdir/doc/tags')
-
- " No permission to read the help file
- call setfperm('Xdir/a/doc/sample.txt', '-w-------')
- call assert_fails('helptags Xdir', 'E153:', getfperm('Xdir/a/doc/sample.txt'))
- call delete('Xdir/a/doc/sample.txt')
- call delete('Xdir/tags')
- endif
-
" Duplicate tags in the help file
call writefile(['*tag1*', '*tag1*', '*tag2*'], 'Xdir/a/doc/sample.txt')
call assert_fails('helptags Xdir', 'E154:')
--- 90,95 ----
***************
*** 118,121 ****
--- 97,129 ----
call delete('Xdir', 'rf')
endfunc

+ func Test_helptag_cmd_readonly()
+ CheckUnix
+ CheckNotRoot
+ " The following tests fail on FreeBSD for some reason
+ CheckNotBSD
+
+ " Read-only tags file
+ call mkdir('Xdir/doc', 'p')
+ call writefile([''], 'Xdir/doc/tags')
+ call writefile([], 'Xdir/doc/sample.txt')
+ call setfperm('Xdir/doc/tags', 'r-xr--r--')
+ call assert_fails('helptags Xdir/doc', 'E152:', getfperm('Xdir/doc/tags'))
+
+ let rtp = &rtp
+ let &rtp = 'Xdir'
+ helptags ALL
+ let &rtp = rtp
+
+ call delete('Xdir/doc/tags')
+
+ " No permission to read the help file
+ call mkdir('Xdir/b/doc', 'p')
+ call writefile([], 'Xdir/b/doc/sample.txt')
+ call setfperm('Xdir/b/doc/sample.txt', '-w-------')
+ call assert_fails('helptags Xdir', 'E153:', getfperm('Xdir/b/doc/sample.txt'))
+ call delete('Xdir', 'rf')
+ endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2622/src/testdir/test_writefile.vim 2021-03-05 20:47:39.793723714 +0100
--- src/testdir/test_writefile.vim 2021-03-19 14:11:43.332585517 +0100
***************
*** 410,415 ****
--- 410,418 ----
func Test_write_readonly_dir()
" On MS-Windows, modifying files in a read-only directory is allowed.
CheckUnix
+ " Root can do it too.
+ CheckNotRoot
+
call mkdir('Xdir')
call writefile(['one'], 'Xdir/Xfile1')
call setfperm('Xdir', 'r-xr--r--')
*** ../vim-8.2.2622/src/version.c 2021-03-18 22:28:53.563835682 +0100
--- src/version.c 2021-03-19 14:12:15.684517552 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2623,
/**/

--
The average life of an organization chart is six months. You can safely
ignore any order from your boss that would take six months to complete.
(Scott Adams - The Dilbert principle)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages