From 6537c421bb626ee92a2487a543e6287d33461bd0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 23 Apr 2018 20:46:16 +0200 Subject: [PATCH 1/2] patch 8.0.1749: VMS: 100% CPU use, redefining mch_open() fails Problem: VMS: 100% CPU use, redefining mch_open() and mch_fopen() fails. Solution: Do not wait indefinitely in RealWaitForChar(). (Neil Rieck) Do not redefine mch_open() and mch_fopen() on VMS. (Zoltan Arpadffy) --- src/os_vms.c | 2 +- src/version.c | 2 ++ src/vim.h | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/os_vms.c b/src/os_vms.c index 84f84ac710..61db3a80b6 100644 --- a/src/os_vms.c +++ b/src/os_vms.c @@ -784,7 +784,7 @@ RealWaitForChar( return 0; } else if (msec < 0) { /* no time-out; wait on indefinitely */ - continue; + return 1; /* fakeout to force a wait in vms_read() */ } else { /* time-out needs to be checked */ status = sys$gettim(&time_curr); diff --git a/src/version.c b/src/version.c index 28a053a58e..55892048d0 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1749, /**/ 1748, /**/ diff --git a/src/vim.h b/src/vim.h index 4b41857903..df396ec051 100644 --- a/src/vim.h +++ b/src/vim.h @@ -2154,8 +2154,9 @@ typedef enum { # define number_width(x) 7 #endif -/* This must come after including proto.h */ -#if !(defined(FEAT_MBYTE) && defined(WIN3264)) +/* This must come after including proto.h. + * For VMS this is defined in macros.h. */ +#if !(defined(FEAT_MBYTE) && defined(WIN3264)) && !defined(VMS) # define mch_open(n, m, p) open((n), (m), (p)) # define mch_fopen(n, p) fopen((n), (p)) #endif From 3b9474b4ad4d85b5396f7f641b436f193dc9d486 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 23 Apr 2018 21:29:48 +0200 Subject: [PATCH 2/2] patch 8.0.1750: crash when clearing loccation list in autocommand Problem: Crash when clearing loccation list in autocommand. Solution: Check if "qi" equals "ql_info". (Yegappan Lakshmanan) --- src/quickfix.c | 6 +----- src/testdir/test_quickfix.vim | 14 ++++++++++++++ src/version.c | 2 ++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/quickfix.c b/src/quickfix.c index 39e3913c09..6142825e3b 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -5897,7 +5897,6 @@ ex_helpgrep(exarg_T *eap) char_u *lang; #endif qf_info_T *qi = &ql_info; - qf_info_T *save_qi; int new_qi = FALSE; win_T *wp; char_u *au_name = NULL; @@ -5951,9 +5950,6 @@ ex_helpgrep(exarg_T *eap) } } - /* Autocommands may change the list. Save it for later comparison */ - save_qi = qi; - regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING); regmatch.rm_ic = FALSE; if (regmatch.regprog != NULL) @@ -6086,7 +6082,7 @@ ex_helpgrep(exarg_T *eap) { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); - if (!new_qi && qi != save_qi && qf_find_buf(qi) == NULL) + if (!new_qi && qi != &ql_info && qf_find_buf(qi) == NULL) /* autocommands made "qi" invalid */ return; } diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index b0e14e6ad0..12bfe32278 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -3175,3 +3175,17 @@ func Test_vimgrep_autocmd() call delete('Xtest2.txt') call setqflist([], 'f') endfunc + +" The following test used to crash Vim +func Test_lhelpgrep_autocmd() + lhelpgrep quickfix + autocmd QuickFixCmdPost * call setloclist(0, [], 'f') + lhelpgrep buffer + call assert_equal('help', &filetype) + call assert_equal(0, getloclist(0, {'nr' : '$'}).nr) + lhelpgrep tabpage + call assert_equal('help', &filetype) + call assert_equal(1, getloclist(0, {'nr' : '$'}).nr) + au! QuickFixCmdPost + new | only +endfunc diff --git a/src/version.c b/src/version.c index 55892048d0..123db5b675 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1750, /**/ 1749, /**/