To: vim_dev@googlegroups.com Subject: Patch 8.2.0103 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0103 Problem: Using null object with execute() has strange effects. Solution: Give an error message ofr Job and Channel. Files: src/testdir/test_execute_func.vim, src/globals.h, src/eval.c, src/evalfunc.c *** ../vim-8.2.0102/src/testdir/test_execute_func.vim 2019-12-01 14:54:55.000000000 +0100 --- src/testdir/test_execute_func.vim 2020-01-08 19:30:50.082871354 +0100 *************** *** 38,45 **** call assert_equal("\nsomething", execute('echo "something"', 'silent!')) call assert_equal("", execute('burp', 'silent!')) call assert_fails('call execute("echo \"x\"", 3.4)', 'E806:') - - call assert_equal("", execute(test_null_string())) endfunc func Test_execute_list() --- 38,43 ---- *************** *** 50,56 **** call assert_equal("\n0\n1\n2\n3", execute(l)) call assert_equal("", execute([])) - call assert_equal("", execute(test_null_list())) endfunc func Test_execute_does_not_change_col() --- 48,53 ---- *************** *** 132,134 **** --- 129,143 ---- tabclose unlet xyz endfunc + + func Test_execute_null() + call assert_equal("", execute(test_null_string())) + call assert_equal("", execute(test_null_list())) + call assert_fails('call execute(test_null_dict())', 'E731:') + call assert_fails('call execute(test_null_blob())', 'E976:') + call assert_fails('call execute(test_null_partial())','E729:') + if has('job') + call assert_fails('call execute(test_null_job())', 'E908:') + call assert_fails('call execute(test_null_channel())', 'E908:') + endif + endfunc *** ../vim-8.2.0102/src/globals.h 2020-01-01 15:46:43.665568753 +0100 --- src/globals.h 2020-01-08 19:20:21.397514379 +0100 *************** *** 1599,1604 **** --- 1599,1605 ---- EXTERN char e_listblobreq[] INIT(= N_("E897: List or Blob required")); EXTERN char e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary")); EXTERN char e_listdictblobarg[] INIT(= N_("E896: Argument of %s must be a List, Dictionary or Blob")); + EXTERN char e_inval_string[] INIT(= N_("E908: using an invalid value as a String")); #endif #ifdef FEAT_QUICKFIX EXTERN char e_readerrf[] INIT(= N_("E47: Error while reading errorfile")); *** ../vim-8.2.0102/src/eval.c 2020-01-08 18:56:16.951241888 +0100 --- src/eval.c 2020-01-08 19:19:42.185688408 +0100 *************** *** 5667,5673 **** #endif break; case VAR_UNKNOWN: ! emsg(_("E908: using an invalid value as a String")); break; } return NULL; --- 5667,5673 ---- #endif break; case VAR_UNKNOWN: ! emsg(_(e_inval_string)); break; } return NULL; *** ../vim-8.2.0102/src/evalfunc.c 2020-01-02 14:02:12.316159489 +0100 --- src/evalfunc.c 2020-01-08 19:22:36.664925301 +0100 *************** *** 2015,2020 **** --- 2015,2026 ---- return; ++list->lv_refcount; } + else if (argvars[arg_off].v_type == VAR_JOB + || argvars[arg_off].v_type == VAR_CHANNEL) + { + emsg(_(e_inval_string)); + return; + } else { cmd = tv_get_string_chk(&argvars[arg_off]); *** ../vim-8.2.0102/src/version.c 2020-01-08 19:27:35.339668702 +0100 --- src/version.c 2020-01-08 19:31:41.642662229 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 103, /**/ -- bashian roulette: $ ((RANDOM%6)) || rm -rf ~ /// 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 ///