Patch 8.2.3167

3 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 15, 2021, 12:15:29 PM7/15/21
to vim...@googlegroups.com

Patch 8.2.3167
Problem: Get E12 in a job callback when searching for tags. (Andy Stewart)
Solution: Use the sandbox only for executing a command, not for searching.
(closes #8511)
Files: src/tag.c


*** ../vim-8.2.3166/src/tag.c 2021-05-18 21:46:27.712961269 +0200
--- src/tag.c 2021-07-05 19:58:43.361996309 +0200
***************
*** 3312,3318 ****
int forceit, // :ta with !
int keep_help) // keep help flag (FALSE for cscope)
{
- int save_secure;
optmagic_T save_magic_overruled;
int save_p_ws, save_p_scs, save_p_ic;
linenr_T save_lnum;
--- 3312,3317 ----
***************
*** 3500,3510 ****
curwin->w_set_curswant = TRUE;
postponed_split = 0;

- save_secure = secure;
- secure = 1;
- #ifdef HAVE_SANDBOX
- ++sandbox;
- #endif
save_magic_overruled = magic_overruled;
magic_overruled = OPTION_MAGIC_OFF; // always execute with 'nomagic'
#ifdef FEAT_SEARCH_EXTRA
--- 3499,3504 ----
***************
*** 3621,3642 ****
}
else
{
curwin->w_cursor.lnum = 1; // start command in line 1
do_cmdline_cmd(pbuf);
retval = OK;
- }

! /*
! * When the command has done something that is not allowed make sure
! * the error message can be seen.
! */
! if (secure == 2)
! wait_return(TRUE);
! secure = save_secure;
! magic_overruled = save_magic_overruled;
#ifdef HAVE_SANDBOX
! --sandbox;
#endif
#ifdef FEAT_SEARCH_EXTRA
// restore no_hlsearch when keeping the old search pattern
if (search_options)
--- 3615,3642 ----
}
else
{
+ int save_secure = secure;
+
+ // Setup the sandbox for executing the command from the tags file.
+ secure = 1;
+ #ifdef HAVE_SANDBOX
+ ++sandbox;
+ #endif
curwin->w_cursor.lnum = 1; // start command in line 1
do_cmdline_cmd(pbuf);
retval = OK;

! // When the command has done something that is not allowed make
! // sure the error message can be seen.
! if (secure == 2)
! wait_return(TRUE);
! secure = save_secure;
#ifdef HAVE_SANDBOX
! --sandbox;
#endif
+ }
+
+ magic_overruled = save_magic_overruled;
#ifdef FEAT_SEARCH_EXTRA
// restore no_hlsearch when keeping the old search pattern
if (search_options)
*** ../vim-8.2.3166/src/version.c 2021-07-15 18:09:45.371406801 +0200
--- src/version.c 2021-07-15 18:12:04.739153514 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3167,
/**/

--
Although the scythe isn't pre-eminent among the weapons of war, anyone who
has been on the wrong end of, say, a peasants' revolt will know that in
skilled hands it is fearsome.
-- (Terry Pratchett, Mort)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages