To: vim_dev@googlegroups.com Subject: Patch 9.0.0584 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0584 Problem: Cscope test with wrong executable name fails. Solution: Use /bin/sh to execute the command. (Yegappan Lakshmanan) Files: src/if_cscope.c, src/testdir/test_cscope.vim *** ../vim-9.0.0583/src/if_cscope.c 2022-08-29 15:06:46.716715543 +0100 --- src/if_cscope.c 2022-09-25 16:58:19.376875930 +0100 *************** *** 799,805 **** return NULL; } ! // Skip white space before the patter, except for text and pattern search, // they may want to use the leading white space. pat = pattern; if (search != 4 && search != 6) --- 799,805 ---- return NULL; } ! // Skip white space before the pattern, except for text and pattern search, // they may want to use the leading white space. pat = pattern; if (search != 4 && search != 6) *************** *** 825,830 **** --- 825,831 ---- #ifdef UNIX int to_cs[2], from_cs[2]; #endif + int cmdlen; int len; char *prog, *cmd, *ppath = NULL; #ifdef MSWIN *************** *** 917,923 **** expand_env(p_csprg, (char_u *)prog, MAXPATHL); // alloc space to hold the cscope command ! len = (int)(strlen(prog) + strlen(csinfo[i].fname) + 32); if (csinfo[i].ppath) { // expand the prepend path for env var's --- 918,924 ---- expand_env(p_csprg, (char_u *)prog, MAXPATHL); // alloc space to hold the cscope command ! cmdlen = (int)(strlen(prog) + strlen(csinfo[i].fname) + 32); if (csinfo[i].ppath) { // expand the prepend path for env var's *************** *** 933,945 **** } expand_env((char_u *)csinfo[i].ppath, (char_u *)ppath, MAXPATHL); ! len += (int)strlen(ppath); } if (csinfo[i].flags) ! len += (int)strlen(csinfo[i].flags); ! if ((cmd = alloc(len)) == NULL) { vim_free(prog); vim_free(ppath); --- 934,946 ---- } expand_env((char_u *)csinfo[i].ppath, (char_u *)ppath, MAXPATHL); ! cmdlen += (int)strlen(ppath); } if (csinfo[i].flags) ! cmdlen += (int)strlen(csinfo[i].flags); ! if ((cmd = alloc(cmdlen)) == NULL) { vim_free(prog); vim_free(ppath); *************** *** 952,968 **** } // run the cscope command ! (void)sprintf(cmd, "%s -dl -f %s", prog, csinfo[i].fname); ! if (csinfo[i].ppath != NULL) { ! (void)strcat(cmd, " -P"); ! (void)strcat(cmd, csinfo[i].ppath); } if (csinfo[i].flags != NULL) { ! (void)strcat(cmd, " "); ! (void)strcat(cmd, csinfo[i].flags); } # ifdef UNIX // on Win32 we still need prog --- 953,973 ---- } // run the cscope command ! #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) { ! len = STRLEN(cmd); ! vim_snprintf(cmd + len, cmdlen - len, " -P%s", csinfo[i].ppath); } if (csinfo[i].flags != NULL) { ! len = STRLEN(cmd); ! vim_snprintf(cmd + len, cmdlen - len, " %s", csinfo[i].flags); } # ifdef UNIX // on Win32 we still need prog *** ../vim-9.0.0583/src/testdir/test_cscope.vim 2022-09-23 23:19:09.045924621 +0100 --- src/testdir/test_cscope.vim 2022-09-25 17:00:49.192609517 +0100 *************** *** 241,255 **** let a = execute('cscope kill -1') call assert_equal('', a) ! " Test: 'csprg' option ! " Skip this with valgrind, it causes spurious leak reports ! " FIXME: this causes failures when timers are used ! if !RunningWithValgrind() && 0 ! call assert_equal('cscope', &csprg) ! set csprg=doesnotexist ! call assert_fails('cscope add Xcscope2.out', 'E262:') ! set csprg=cscope ! endif " Test: multiple cscope connections cscope add Xcscope.out --- 241,251 ---- let a = execute('cscope kill -1') call assert_equal('', a) ! " Test: 'csprg' option invalid command ! call assert_equal('cscope', &csprg) ! set csprg=doesnotexist ! call assert_fails('cscope add Xcscope2.out', 'E609:') ! set csprg=cscope " Test: multiple cscope connections cscope add Xcscope.out *** ../vim-9.0.0583/src/version.c 2022-09-25 12:35:45.615655615 +0100 --- src/version.c 2022-09-25 16:59:16.768770329 +0100 *************** *** 701,702 **** --- 701,704 ---- { /* Add new patch number below this line */ + /**/ + 584, /**/ -- hundred-and-one symptoms of being an internet addict: 169. You hire a housekeeper for your home page. /// Bram Moolenaar -- Bram@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 ///