0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 8.0.0442: patch shell command not well escaped

Problem:    Patch shell command uses double quotes around the argument, which
            allows for $HOME to be expanded. (Etienne)
Solution:   Use single quotes on Unix. (closes #1543)
This commit is contained in:
Bram Moolenaar
2017-03-09 19:21:30 +01:00
parent ad2cfb54b7
commit 1ef73e33c9
3 changed files with 22 additions and 4 deletions

View File

@@ -318,9 +318,20 @@ func Test_diffpatch()
bwipe!
new
call assert_fails('diffpatch Xpatch', 'E816:')
call setline(1, ['1', '2', '3'])
diffpatch Xpatch
call assert_equal(['1', '2x', '3', '4'], getline(1, '$'))
for name in ['Xpatch', 'Xpatch$HOME']
call setline(1, ['1', '2', '3'])
if name != 'Xpatch'
call rename('Xpatch', name)
endif
exe 'diffpatch ' . escape(name, '$')
call assert_equal(['1', '2x', '3', '4'], getline(1, '$'))
if name != 'Xpatch'
call rename(name, 'Xpatch')
endif
bwipe!
endfor
call delete('Xpatch')
bwipe!
endfunc