Mercurial > vim
comparison src/tag.c @ 25262:e9065d299e9b
patch 8.2.3167: get E12 in a job callback when searching for tags
Commit: https://github.com/vim/vim/commit/547f94f33098b060da9d62c29d9fcbe9bf1e2b11
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 15 18:14:56 2021 +0200
patch 8.2.3167: get E12 in a job callback when searching for tags
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 15 Jul 2021 18:15:04 +0200 |
parents | 661d15592d3c |
children | 35562f3207d1 |
comparison
equal
deleted
inserted
replaced
25261:34254b70c785 | 25262:e9065d299e9b |
---|---|
3310 jumpto_tag( | 3310 jumpto_tag( |
3311 char_u *lbuf_arg, // line from the tags file for this tag | 3311 char_u *lbuf_arg, // line from the tags file for this tag |
3312 int forceit, // :ta with ! | 3312 int forceit, // :ta with ! |
3313 int keep_help) // keep help flag (FALSE for cscope) | 3313 int keep_help) // keep help flag (FALSE for cscope) |
3314 { | 3314 { |
3315 int save_secure; | |
3316 optmagic_T save_magic_overruled; | 3315 optmagic_T save_magic_overruled; |
3317 int save_p_ws, save_p_scs, save_p_ic; | 3316 int save_p_ws, save_p_scs, save_p_ic; |
3318 linenr_T save_lnum; | 3317 linenr_T save_lnum; |
3319 char_u *str; | 3318 char_u *str; |
3320 char_u *pbuf; // search pattern buffer | 3319 char_u *pbuf; // search pattern buffer |
3498 if (GETFILE_SUCCESS(getfile_result)) // got to the right file | 3497 if (GETFILE_SUCCESS(getfile_result)) // got to the right file |
3499 { | 3498 { |
3500 curwin->w_set_curswant = TRUE; | 3499 curwin->w_set_curswant = TRUE; |
3501 postponed_split = 0; | 3500 postponed_split = 0; |
3502 | 3501 |
3503 save_secure = secure; | |
3504 secure = 1; | |
3505 #ifdef HAVE_SANDBOX | |
3506 ++sandbox; | |
3507 #endif | |
3508 save_magic_overruled = magic_overruled; | 3502 save_magic_overruled = magic_overruled; |
3509 magic_overruled = OPTION_MAGIC_OFF; // always execute with 'nomagic' | 3503 magic_overruled = OPTION_MAGIC_OFF; // always execute with 'nomagic' |
3510 #ifdef FEAT_SEARCH_EXTRA | 3504 #ifdef FEAT_SEARCH_EXTRA |
3511 // Save value of no_hlsearch, jumping to a tag is not a real search | 3505 // Save value of no_hlsearch, jumping to a tag is not a real search |
3512 save_no_hlsearch = no_hlsearch; | 3506 save_no_hlsearch = no_hlsearch; |
3619 // of the line. May need to correct that here. | 3613 // of the line. May need to correct that here. |
3620 check_cursor(); | 3614 check_cursor(); |
3621 } | 3615 } |
3622 else | 3616 else |
3623 { | 3617 { |
3618 int save_secure = secure; | |
3619 | |
3620 // Setup the sandbox for executing the command from the tags file. | |
3621 secure = 1; | |
3622 #ifdef HAVE_SANDBOX | |
3623 ++sandbox; | |
3624 #endif | |
3624 curwin->w_cursor.lnum = 1; // start command in line 1 | 3625 curwin->w_cursor.lnum = 1; // start command in line 1 |
3625 do_cmdline_cmd(pbuf); | 3626 do_cmdline_cmd(pbuf); |
3626 retval = OK; | 3627 retval = OK; |
3627 } | 3628 |
3628 | 3629 // When the command has done something that is not allowed make |
3629 /* | 3630 // sure the error message can be seen. |
3630 * When the command has done something that is not allowed make sure | 3631 if (secure == 2) |
3631 * the error message can be seen. | 3632 wait_return(TRUE); |
3632 */ | 3633 secure = save_secure; |
3633 if (secure == 2) | 3634 #ifdef HAVE_SANDBOX |
3634 wait_return(TRUE); | 3635 --sandbox; |
3635 secure = save_secure; | 3636 #endif |
3637 } | |
3638 | |
3636 magic_overruled = save_magic_overruled; | 3639 magic_overruled = save_magic_overruled; |
3637 #ifdef HAVE_SANDBOX | |
3638 --sandbox; | |
3639 #endif | |
3640 #ifdef FEAT_SEARCH_EXTRA | 3640 #ifdef FEAT_SEARCH_EXTRA |
3641 // restore no_hlsearch when keeping the old search pattern | 3641 // restore no_hlsearch when keeping the old search pattern |
3642 if (search_options) | 3642 if (search_options) |
3643 set_no_hlsearch(save_no_hlsearch); | 3643 set_no_hlsearch(save_no_hlsearch); |
3644 #endif | 3644 #endif |