0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.0.0584: cscope test with wrong executable name fails

Problem:    Cscope test with wrong executable name fails.
Solution:   Use /bin/sh to execute the command. (Yegappan Lakshmanan)
This commit is contained in:
Bram Moolenaar
2022-09-25 17:03:26 +01:00
parent b9725bc7f6
commit dc21552c9a
3 changed files with 23 additions and 20 deletions

View File

@@ -799,7 +799,7 @@ cs_create_cmd(char *csoption, char *pattern)
return NULL; return NULL;
} }
// Skip white space before the patter, except for text and pattern search, // Skip white space before the pattern, except for text and pattern search,
// they may want to use the leading white space. // they may want to use the leading white space.
pat = pattern; pat = pattern;
if (search != 4 && search != 6) if (search != 4 && search != 6)
@@ -825,6 +825,7 @@ cs_create_connection(int i)
#ifdef UNIX #ifdef UNIX
int to_cs[2], from_cs[2]; int to_cs[2], from_cs[2];
#endif #endif
int cmdlen;
int len; int len;
char *prog, *cmd, *ppath = NULL; char *prog, *cmd, *ppath = NULL;
#ifdef MSWIN #ifdef MSWIN
@@ -917,7 +918,7 @@ err_closing:
expand_env(p_csprg, (char_u *)prog, MAXPATHL); expand_env(p_csprg, (char_u *)prog, MAXPATHL);
// alloc space to hold the cscope command // alloc space to hold the cscope command
len = (int)(strlen(prog) + strlen(csinfo[i].fname) + 32); cmdlen = (int)(strlen(prog) + strlen(csinfo[i].fname) + 32);
if (csinfo[i].ppath) if (csinfo[i].ppath)
{ {
// expand the prepend path for env var's // expand the prepend path for env var's
@@ -933,13 +934,13 @@ err_closing:
} }
expand_env((char_u *)csinfo[i].ppath, (char_u *)ppath, MAXPATHL); expand_env((char_u *)csinfo[i].ppath, (char_u *)ppath, MAXPATHL);
len += (int)strlen(ppath); cmdlen += (int)strlen(ppath);
} }
if (csinfo[i].flags) if (csinfo[i].flags)
len += (int)strlen(csinfo[i].flags); cmdlen += (int)strlen(csinfo[i].flags);
if ((cmd = alloc(len)) == NULL) if ((cmd = alloc(cmdlen)) == NULL)
{ {
vim_free(prog); vim_free(prog);
vim_free(ppath); vim_free(ppath);
@@ -952,17 +953,21 @@ err_closing:
} }
// run the cscope command // run the cscope command
(void)sprintf(cmd, "%s -dl -f %s", prog, csinfo[i].fname); #ifdef UNIX
vim_snprintf(cmd, cmdlen, "/bin/sh -c \"exec %s -dl -f %s\"",
prog, csinfo[i].fname);
#else
vim_snprintf(cmd, cmdlen, "%s -dl -f %s", prog, csinfo[i].fname);
#endif
if (csinfo[i].ppath != NULL) if (csinfo[i].ppath != NULL)
{ {
(void)strcat(cmd, " -P"); len = STRLEN(cmd);
(void)strcat(cmd, csinfo[i].ppath); vim_snprintf(cmd + len, cmdlen - len, " -P%s", csinfo[i].ppath);
} }
if (csinfo[i].flags != NULL) if (csinfo[i].flags != NULL)
{ {
(void)strcat(cmd, " "); len = STRLEN(cmd);
(void)strcat(cmd, csinfo[i].flags); vim_snprintf(cmd + len, cmdlen - len, " %s", csinfo[i].flags);
} }
# ifdef UNIX # ifdef UNIX
// on Win32 we still need prog // on Win32 we still need prog

View File

@@ -241,15 +241,11 @@ func Test_cscopeWithCscopeConnections()
let a = execute('cscope kill -1') let a = execute('cscope kill -1')
call assert_equal('', a) call assert_equal('', a)
" Test: 'csprg' option " Test: 'csprg' option invalid command
" Skip this with valgrind, it causes spurious leak reports call assert_equal('cscope', &csprg)
" FIXME: this causes failures when timers are used set csprg=doesnotexist
if !RunningWithValgrind() && 0 call assert_fails('cscope add Xcscope2.out', 'E609:')
call assert_equal('cscope', &csprg) set csprg=cscope
set csprg=doesnotexist
call assert_fails('cscope add Xcscope2.out', 'E262:')
set csprg=cscope
endif
" Test: multiple cscope connections " Test: multiple cscope connections
cscope add Xcscope.out cscope add Xcscope.out

View File

@@ -699,6 +699,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
584,
/**/ /**/
583, 583,
/**/ /**/