To: vim_dev@googlegroups.com Subject: Patch 8.1.1846 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1846 Problem: Inconsistently using GetVimCommand() and v:progpath. (Daniel Hahler) Solution: Use GetVimCommand(). (closes #4806) Files: src/testdir/test_autocmd.vim, src/testdir/test_gui.vim, src/testdir/test_normal.vim, src/testdir/test_profile.vim, src/testdir/test_suspend.vim, src/testdir/test_system.vim, src/testdir/test_vimscript.vim *** ../vim-8.1.1845/src/testdir/test_autocmd.vim 2019-08-07 23:07:03.956858953 +0200 --- src/testdir/test_autocmd.vim 2019-08-14 20:52:46.663016421 +0200 *************** *** 439,445 **** [CODE] call writefile(content, 'Xvimrc') ! call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') let errors = join(readfile('Xerrors')) call assert_match('E814', errors) --- 439,445 ---- [CODE] call writefile(content, 'Xvimrc') ! call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq') let errors = join(readfile('Xerrors')) call assert_match('E814', errors) *************** *** 479,485 **** [CODE] call writefile(content, 'Xvimrc') ! call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') let errors = join(readfile('Xerrors')) " This probably only ever matches on unix. call assert_notmatch('Caught deadly signal SEGV', errors) --- 479,485 ---- [CODE] call writefile(content, 'Xvimrc') ! call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq') let errors = join(readfile('Xerrors')) " This probably only ever matches on unix. call assert_notmatch('Caught deadly signal SEGV', errors) *************** *** 1422,1428 **** call writefile(content, 'Xtest') call delete('Xout') ! call system(v:progpath. ' --clean -N --not-a-term -S Xtest') call assert_true(filereadable('Xout')) call delete('Xxx1') --- 1422,1428 ---- call writefile(content, 'Xtest') call delete('Xout') ! call system(GetVimCommandClean() .. ' -N --not-a-term -S Xtest') call assert_true(filereadable('Xout')) call delete('Xxx1') *** ../vim-8.1.1845/src/testdir/test_gui.vim 2019-08-07 23:07:03.960858821 +0200 --- src/testdir/test_gui.vim 2019-08-14 20:54:22.610628407 +0200 *************** *** 127,136 **** let test_call = 'Can you hear me?' let test_response = 'Yes, I can.' ! let vim_exe = exepath(v:progpath) let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;' ! \ . vim_exe ! \ . ' -u NONE -U NONE --noplugin --not-a-term -c ''%s''' " Ignore the "failed to create input context" error. let cmd = 'call test_ignore_error("E285") | ' \ . 'gui -f | ' --- 127,135 ---- let test_call = 'Can you hear me?' let test_response = 'Yes, I can.' ! let vim_exe = GetVimCommand() let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;' ! \ . vim_exe . ' --noplugin --not-a-term -c ''%s''' " Ignore the "failed to create input context" error. let cmd = 'call test_ignore_error("E285") | ' \ . 'gui -f | ' *** ../vim-8.1.1845/src/testdir/test_normal.vim 2019-08-11 22:50:53.828345974 +0200 --- src/testdir/test_normal.vim 2019-08-14 20:56:03.066208311 +0200 *************** *** 1096,1102 **** endif call writefile(['1a', 'foo', 'bar', '.', 'w! Xfile2', 'q!'], 'Xscript') call writefile(['1', '2'], 'Xfile') ! call system(v:progpath .' -e -s < Xscript Xfile') let a=readfile('Xfile2') call assert_equal(['1', 'foo', 'bar', '2'], a) --- 1096,1102 ---- endif call writefile(['1a', 'foo', 'bar', '.', 'w! Xfile2', 'q!'], 'Xscript') call writefile(['1', '2'], 'Xfile') ! call system(GetVimCommand() .. ' -e -s < Xscript Xfile') let a=readfile('Xfile2') call assert_equal(['1', 'foo', 'bar', '2'], a) *************** *** 1143,1155 **** " let shell = &shell " let &shell = 'sh' call writefile(['1', '2'], 'Xfile') ! let args = ' -u NONE -N -U NONE -i NONE --noplugins -X --not-a-term' ! call system(v:progpath . args . ' -c "%d" -c ":norm! ZZ" Xfile') let a = readfile('Xfile') call assert_equal([], a) " Test for ZQ call writefile(['1', '2'], 'Xfile') ! call system(v:progpath . args . ' -c "%d" -c ":norm! ZQ" Xfile') let a = readfile('Xfile') call assert_equal(['1', '2'], a) --- 1143,1155 ---- " let shell = &shell " let &shell = 'sh' call writefile(['1', '2'], 'Xfile') ! let args = ' -N -i NONE --noplugins -X --not-a-term' ! call system(GetVimCommand() .. args .. ' -c "%d" -c ":norm! ZZ" Xfile') let a = readfile('Xfile') call assert_equal([], a) " Test for ZQ call writefile(['1', '2'], 'Xfile') ! call system(GetVimCommand() . args . ' -c "%d" -c ":norm! ZQ" Xfile') let a = readfile('Xfile') call assert_equal(['1', '2'], a) *** ../vim-8.1.1845/src/testdir/test_profile.vim 2019-06-24 00:58:02.908020514 +0200 --- src/testdir/test_profile.vim 2019-08-14 21:06:52.775284579 +0200 *************** *** 3,8 **** --- 3,10 ---- source check.vim CheckFeature profile + source shared.vim + func Test_profile_func() let lines =<< trim [CODE] profile start Xprofile_func.log *************** *** 34,40 **** [CODE] call writefile(lines, 'Xprofile_func.vim') ! call system(v:progpath \ . ' -es --clean' \ . ' -c "so Xprofile_func.vim"' \ . ' -c "qall!"') --- 36,42 ---- [CODE] call writefile(lines, 'Xprofile_func.vim') ! call system(GetVimCommand() \ . ' -es --clean' \ . ' -c "so Xprofile_func.vim"' \ . ' -c "qall!"') *************** *** 120,127 **** [CODE] call writefile(lines, 'Xprofile_func.vim') ! call system(v:progpath ! \ . ' -es -u NONE -U NONE -i NONE --noplugin' \ . ' -c "profile start Xprofile_func.log"' \ . ' -c "profile func Foo*"' \ . ' -c "so Xprofile_func.vim"' --- 122,129 ---- [CODE] call writefile(lines, 'Xprofile_func.vim') ! call system(GetVimCommand() ! \ . ' -es -i NONE --noplugin' \ . ' -c "profile start Xprofile_func.log"' \ . ' -c "profile func Foo*"' \ . ' -c "so Xprofile_func.vim"' *************** *** 233,240 **** [CODE] call writefile(lines, 'Xprofile_func.vim') ! call system(v:progpath ! \ . ' -es -u NONE -U NONE -i NONE --noplugin' \ . ' -c "profile start Xprofile_func.log"' \ . ' -c "profile func Foo*"' \ . ' -c "so Xprofile_func.vim"' --- 235,242 ---- [CODE] call writefile(lines, 'Xprofile_func.vim') ! call system(GetVimCommand() ! \ . ' -es -i NONE --noplugin' \ . ' -c "profile start Xprofile_func.log"' \ . ' -c "profile func Foo*"' \ . ' -c "so Xprofile_func.vim"' *************** *** 320,327 **** [CODE] call writefile(lines, 'Xprofile_file.vim') ! call system(v:progpath ! \ . ' -es --clean' \ . ' -c "profile start Xprofile_file.log"' \ . ' -c "profile file Xprofile_file.vim"' \ . ' -c "so Xprofile_file.vim"' --- 322,329 ---- [CODE] call writefile(lines, 'Xprofile_file.vim') ! call system(GetVimCommandClean() ! \ . ' -es' \ . ' -c "profile start Xprofile_file.log"' \ . ' -c "profile file Xprofile_file.vim"' \ . ' -c "so Xprofile_file.vim"' *************** *** 365,372 **** \ ] call writefile(lines, 'Xprofile_file.vim') ! call system(v:progpath ! \ . ' -es --clean' \ . ' -c "profile start Xprofile_file.log"' \ . ' -c "profile file Xprofile_file.vim"' \ . ' -c "so Xprofile_file.vim"' --- 367,374 ---- \ ] call writefile(lines, 'Xprofile_file.vim') ! call system(GetVimCommandClean() ! \ . ' -es' \ . ' -c "profile start Xprofile_file.log"' \ . ' -c "profile file Xprofile_file.vim"' \ . ' -c "so Xprofile_file.vim"' *************** *** 423,430 **** \ ] call writefile(lines, 'Xprofile_file.vim') ! call system(v:progpath ! \ . ' -es --clean --cmd "set enc=utf-8"' \ . ' -c "profile start Xprofile_file.log"' \ . ' -c "profile file Xprofile_file.vim"' \ . ' -c "so Xprofile_file.vim"' --- 425,432 ---- \ ] call writefile(lines, 'Xprofile_file.vim') ! call system(GetVimCommandClean() ! \ . ' -es --cmd "set enc=utf-8"' \ . ' -c "profile start Xprofile_file.log"' \ . ' -c "profile file Xprofile_file.vim"' \ . ' -c "so Xprofile_file.vim"' *************** *** 470,476 **** call Foo3() [CODE] call writefile(lines, 'Xprofile_file.vim') ! call system(v:progpath . ' -es --clean -c "so Xprofile_file.vim" -c q') call assert_equal(0, v:shell_error) let lines = readfile('Xprofile_file.log') --- 472,478 ---- call Foo3() [CODE] call writefile(lines, 'Xprofile_file.vim') ! call system(GetVimCommandClean() . ' -es -c "so Xprofile_file.vim" -c q') call assert_equal(0, v:shell_error) let lines = readfile('Xprofile_file.log') *************** *** 505,511 **** call Foo() [CODE] call writefile(lines, 'Xprofile_file.vim') ! call system(v:progpath . ' -es --clean -c "so Xprofile_file.vim" -c q') call assert_equal(0, v:shell_error) let lines = readfile('Xprofile_file.log') --- 507,513 ---- call Foo() [CODE] call writefile(lines, 'Xprofile_file.vim') ! call system(GetVimCommandClean() . ' -es -c "so Xprofile_file.vim" -c q') call assert_equal(0, v:shell_error) let lines = readfile('Xprofile_file.log') *** ../vim-8.1.1845/src/testdir/test_suspend.vim 2019-07-08 20:58:22.315648064 +0200 --- src/testdir/test_suspend.vim 2019-08-14 21:03:49.920132193 +0200 *************** *** 26,33 **** " Wait for shell prompt. call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) ! call term_sendkeys(buf, v:progpath ! \ . " --clean -X" \ . " -c 'set nu'" \ . " -c 'call setline(1, \"foo\")'" \ . " Xfoo\") --- 26,33 ---- " Wait for shell prompt. call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) ! call term_sendkeys(buf, GetVimCommandClean() ! \ . " -X" \ . " -c 'set nu'" \ . " -c 'call setline(1, \"foo\")'" \ . " Xfoo\") *** ../vim-8.1.1845/src/testdir/test_system.vim 2019-08-04 17:35:49.331707782 +0200 --- src/testdir/test_system.vim 2019-08-14 21:07:15.679177597 +0200 *************** *** 1,5 **** --- 1,7 ---- " Tests for system() and systemlist() + source shared.vim + func Test_System() if !executable('echo') || !executable('cat') || !executable('wc') return *************** *** 49,59 **** func Test_system_exmode() if has('unix') " echo $? only works on Unix ! let cmd = ' -es -u NONE -c "source Xscript" +q; echo "result=$?"' " Need to put this in a script, "catch" isn't found after an unknown " function. call writefile(['try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') ! let a = system(v:progpath . cmd) call assert_match('result=0', a) call assert_equal(0, v:shell_error) endif --- 51,61 ---- func Test_system_exmode() if has('unix') " echo $? only works on Unix ! let cmd = ' -es -c "source Xscript" +q; echo "result=$?"' " Need to put this in a script, "catch" isn't found after an unknown " function. call writefile(['try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') ! let a = system(GetVimCommand() . cmd) call assert_match('result=0', a) call assert_equal(0, v:shell_error) endif *************** *** 61,92 **** " Error before try does set error flag. call writefile(['call nosuchfunction()', 'try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') if has('unix') " echo $? only works on Unix ! let a = system(v:progpath . cmd) call assert_notequal('0', a[0]) endif ! let cmd = ' -es -u NONE -c "source Xscript" +q' ! let a = system(v:progpath . cmd) call assert_notequal(0, v:shell_error) call delete('Xscript') if has('unix') " echo $? only works on Unix ! let cmd = ' -es -u NONE -c "call doesnotexist()" +q; echo $?' ! let a = system(v:progpath. cmd) call assert_notequal(0, a[0]) endif ! let cmd = ' -es -u NONE -c "call doesnotexist()" +q' ! let a = system(v:progpath. cmd) call assert_notequal(0, v:shell_error) if has('unix') " echo $? only works on Unix ! let cmd = ' -es -u NONE -c "call doesnotexist()|let a=1" +q; echo $?' ! let a = system(v:progpath. cmd) call assert_notequal(0, a[0]) endif ! let cmd = ' -es -u NONE -c "call doesnotexist()|let a=1" +q' ! let a = system(v:progpath. cmd) call assert_notequal(0, v:shell_error) endfunc --- 63,94 ---- " Error before try does set error flag. call writefile(['call nosuchfunction()', 'try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') if has('unix') " echo $? only works on Unix ! let a = system(GetVimCommand() . cmd) call assert_notequal('0', a[0]) endif ! let cmd = ' -es -c "source Xscript" +q' ! let a = system(GetVimCommand() . cmd) call assert_notequal(0, v:shell_error) call delete('Xscript') if has('unix') " echo $? only works on Unix ! let cmd = ' -es -c "call doesnotexist()" +q; echo $?' ! let a = system(GetVimCommand() . cmd) call assert_notequal(0, a[0]) endif ! let cmd = ' -es -c "call doesnotexist()" +q' ! let a = system(GetVimCommand(). cmd) call assert_notequal(0, v:shell_error) if has('unix') " echo $? only works on Unix ! let cmd = ' -es -c "call doesnotexist()|let a=1" +q; echo $?' ! let a = system(GetVimCommand() . cmd) call assert_notequal(0, a[0]) endif ! let cmd = ' -es -c "call doesnotexist()|let a=1" +q' ! let a = system(GetVimCommand() . cmd) call assert_notequal(0, v:shell_error) endfunc *** ../vim-8.1.1845/src/testdir/test_vimscript.vim 2019-08-07 23:07:03.964858688 +0200 --- src/testdir/test_vimscript.vim 2019-08-14 21:07:27.643121639 +0200 *************** *** 2,7 **** --- 2,8 ---- " Most of this was formerly in test49. source check.vim + source shared.vim "------------------------------------------------------------------------------- " Test environment {{{1 *************** *** 1721,1727 **** [CODE] call writefile(lines, 'Xtest.vim') ! let res = system(v:progpath .. ' --clean -es -X -S Xtest.vim') call assert_equal(0, v:shell_error) let m = matchstr(res, 'function F1()[^[:print:]]*[[:print:]]*') --- 1722,1728 ---- [CODE] call writefile(lines, 'Xtest.vim') ! let res = system(GetVimCommandClean() .. ' -es -X -S Xtest.vim') call assert_equal(0, v:shell_error) let m = matchstr(res, 'function F1()[^[:print:]]*[[:print:]]*') *** ../vim-8.1.1845/src/version.c 2019-08-13 23:09:44.574400577 +0200 --- src/version.c 2019-08-14 21:11:12.690062059 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 1846, /**/ -- ERROR 047: Keyboard not found. Press RETURN to continue. /// Bram Moolenaar -- Bram@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 ///