From 254454d0c5a92acaa2c7d199236c216a9de8b6ee Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 12 Jun 2022 19:06:30 +0800 Subject: vim-patch:8.2.5079: DirChanged autocommand may use freed memory Problem: DirChanged autocommand may use freed memory. (Shane-XB Qian) Solution: Free the memory later. (closes vim/vim#10555) https://github.com/vim/vim/commit/d8c9d32c8932e93008bfd4e8828ed42f4e9f8315 Code change is N/A as Nvim gets the full current directory again before applying the autocommand, so this just ports the tests. --- src/nvim/testdir/test_autocmd.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim') diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 13be82a71d..9d4568b196 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -1981,6 +1981,13 @@ function Test_dirchanged_global() call assert_equal(expected, s:li) exe 'lcd ' .. fnameescape(s:dir_bar) call assert_equal(expected, s:li) + + exe 'cd ' .. s:dir_foo + exe 'cd ' .. s:dir_bar + autocmd! test_dirchanged DirChanged global let g:result = expand("") + cd - + call assert_equal(s:dir_foo, g:result) + call s:After_test_dirchanged() endfunc -- cgit From 1c16e5bb1105e1e0b668d5acb7830c69b78fec0e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 13 Jun 2022 16:05:15 +0800 Subject: vim-patch:8.2.5081: autocmd test fails on MS-Windows Problem: Autocmd test fails on MS-Windows. Solution: Set shellslash to get forward slashes. https://github.com/vim/vim/commit/7c0d0c3c75151e716184397a41ff74ab0429db5a --- src/nvim/testdir/test_autocmd.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim') diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 9d4568b196..8d8b05ec94 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -1982,12 +1982,15 @@ function Test_dirchanged_global() exe 'lcd ' .. fnameescape(s:dir_bar) call assert_equal(expected, s:li) + let save_shellslash = &shellslash + set shellslash exe 'cd ' .. s:dir_foo exe 'cd ' .. s:dir_bar autocmd! test_dirchanged DirChanged global let g:result = expand("") cd - call assert_equal(s:dir_foo, g:result) + let &shellslash = save_shellslash call s:After_test_dirchanged() endfunc -- cgit From e95f32a717898afea9af214e969cce9a787a8fa2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 13 Jun 2022 16:05:22 +0800 Subject: vim-patch:8.2.5083: autocmd test still fails on MS-Windows Problem: Autocmd test still fails on MS-Windows. Solution: Change backward to forward slashes. https://github.com/vim/vim/commit/db77c49401145d76441fbb3d22a1d7d987681c13 --- src/nvim/testdir/test_autocmd.vim | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/nvim') diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 8d8b05ec94..660801d575 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -1982,15 +1982,12 @@ function Test_dirchanged_global() exe 'lcd ' .. fnameescape(s:dir_bar) call assert_equal(expected, s:li) - let save_shellslash = &shellslash - set shellslash exe 'cd ' .. s:dir_foo exe 'cd ' .. s:dir_bar autocmd! test_dirchanged DirChanged global let g:result = expand("") cd - - call assert_equal(s:dir_foo, g:result) + call assert_equal(s:dir_foo, substitute(g:result, '\\', '/', 'g')) - let &shellslash = save_shellslash call s:After_test_dirchanged() endfunc -- cgit