To: vim_dev@googlegroups.com Subject: Patch 9.0.0217 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0217 Problem: 'shellslash' works differently when sourcing a script again. Solution: Use the name from the script item. (closes #10920) Files: src/scriptfile.c, src/testdir/test_expand_func.vim *** ../vim-9.0.0216/src/scriptfile.c 2022-06-29 12:54:48.068572061 +0100 --- src/scriptfile.c 2022-08-15 17:51:29.489198179 +0100 *************** *** 1534,1543 **** cookie.level = ex_nesting_level; #endif - // Keep the sourcing name/lnum, for recursive calls. - estack_push(ETYPE_SCRIPT, fname_exp, 0); - ESTACK_CHECK_SETUP - #ifdef STARTUPTIME if (time_fd != NULL) time_push(&tv_rel, &tv_start); --- 1534,1539 ---- *************** *** 1630,1635 **** --- 1626,1635 ---- si->sn_is_vimrc = is_vimrc; } + // Keep the sourcing name/lnum, for recursive calls. + estack_push(ETYPE_SCRIPT, si->sn_name, 0); + ESTACK_CHECK_SETUP + # ifdef FEAT_PROFILE if (do_profiling == PROF_YES) { *** ../vim-9.0.0216/src/testdir/test_expand_func.vim 2022-04-28 19:06:24.000000000 +0100 --- src/testdir/test_expand_func.vim 2022-08-15 17:51:29.489198179 +0100 *************** *** 41,47 **** call assert_match('test_expand_func\.vim$', s:sfile) let expected = 'script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack' call assert_match(expected .. '$', expand('')) ! call assert_match(expected .. '\[4\]' , expand('')) " Call in script-local function call assert_match('script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack\[7\]\.\.\d\+_expand_sfile$', s:expand_sfile()) --- 41,47 ---- call assert_match('test_expand_func\.vim$', s:sfile) let expected = 'script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack' call assert_match(expected .. '$', expand('')) ! call assert_match(expected .. '\[4\]$' , expand('')) " Call in script-local function call assert_match('script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack\[7\]\.\.\d\+_expand_sfile$', s:expand_sfile()) *************** *** 59,65 **** --- 59,90 ---- call writefile(lines, 'Xstack') source Xstack call assert_match('\') + set noshellslash + let g:stack2 = expand('') + set shellslash + let g:stack3 = expand('') + END + call writefile(lines, 'Xshellslash/Xstack') + " Test that changing 'shellslash' always affects the result of expand() + " when sourcing a script multiple times. + for i in range(2) + source Xshellslash/Xstack + call assert_match('\