{"action":"created","issue":{"url":"https://api.github.com/repos/vim/vim/issues/1225","repository_url":"https://api.github.com/repos/vim/vim","labels_url":"https://api.github.com/repos/vim/vim/issues/1225/labels{/name}","comments_url":"https://api.github.com/repos/vim/vim/issues/1225/comments","events_url":"https://api.github.com/repos/vim/vim/issues/1225/events","html_url":"https://github.com/vim/vim/issues/1225","id":187230482,"number":1225,"title":"7.4.2299 causes lgetexpr/laddexpr to fail after a while (test suite)","user":{"login":"blueyed","id":9766,"avatar_url":"https://avatars.githubusercontent.com/u/9766?v=3","gravatar_id":"","url":"https://api.github.com/users/blueyed","html_url":"https://github.com/blueyed","followers_url":"https://api.github.com/users/blueyed/followers","following_url":"https://api.github.com/users/blueyed/following{/other_user}","gists_url":"https://api.github.com/users/blueyed/gists{/gist_id}","starred_url":"https://api.github.com/users/blueyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blueyed/subscriptions","organizations_url":"https://api.github.com/users/blueyed/orgs","repos_url":"https://api.github.com/users/blueyed/repos","events_url":"https://api.github.com/users/blueyed/events{/privacy}","received_events_url":"https://api.github.com/users/blueyed/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-04T01:17:34Z","updated_at":"2016-11-05T22:44:56Z","closed_at":null,"body":"I've noticed that 7.4.2299 (04c4ce6) causes the Neomake tests to fail out of a sudden.\r\n\r\nIt is related to using `laddexpr ''` etc and shows itself when `laddexpr lines` suddenly stops working: `getloclist(0)` returns the old list then still.\r\n\r\nThe setup for this is rather complex, but can be reproduced using `make testvim` (on this PR: https://github.com/neomake/neomake/pull/751).\r\nIt gets triggered by one of the last tests, and moving that one to the beginning (or commenting a bunch of others before it) works around this.\r\n\r\nThe following patch fixes it:\r\n```diff\r\n 1 file changed, 1 insertion(+), 1 deletion(-)\r\n\r\ndiff --git i/src/quickfix.c w/src/quickfix.c\r\nindex 2f5256b..853e621 100644\r\n--- i/src/quickfix.c\r\n+++ w/src/quickfix.c\r\n@@ -4964,7 +4964,7 @@ ex_cexpr(exarg_T *eap)\r\n        apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\r\n                                               curbuf->b_fname, TRUE, curbuf);\r\n # ifdef FEAT_EVAL\r\n-       if (did_throw || force_abort)\r\n+       if (did_throw)\r\n            return;\r\n # endif\r\n     }\r\n```\r\n\r\nThere are more usages of `force_abort` in there, and this maybe only shadows another issue?!\r\n\r\nHow would I debug it from there?\r\n\r\nThe `if (did_throw || force_abort) return;` pattern is not used often, but only in quickfix.c and `src/if_cscope.c`: https://github.com/vim/vim/blob/04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa/src/if_cscope.c#L1190-L1191.\r\nMaybe it's just wrong like that?\r\n\r\n/cc @yegappan (as the author of the patch?!)"},"comment":{"url":"https://api.github.com/repos/vim/vim/issues/comments/258647341","html_url":"https://github.com/vim/vim/issues/1225#issuecomment-258647341","issue_url":"https://api.github.com/repos/vim/vim/issues/1225","id":258647341,"user":{"login":"vim-ml","id":11653528,"avatar_url":"https://avatars.githubusercontent.com/u/11653528?v=3","gravatar_id":"","url":"https://api.github.com/users/vim-ml","html_url":"https://github.com/vim-ml","followers_url":"https://api.github.com/users/vim-ml/followers","following_url":"https://api.github.com/users/vim-ml/following{/other_user}","gists_url":"https://api.github.com/users/vim-ml/gists{/gist_id}","starred_url":"https://api.github.com/users/vim-ml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vim-ml/subscriptions","organizations_url":"https://api.github.com/users/vim-ml/orgs","repos_url":"https://api.github.com/users/vim-ml/repos","events_url":"https://api.github.com/users/vim-ml/events{/privacy}","received_events_url":"https://api.github.com/users/vim-ml/received_events","type":"User","site_admin":false},"created_at":"2016-11-05T22:44:56Z","updated_at":"2016-11-05T22:44:56Z","body":"Hi Bram,\n\nOn Sat, Nov 5, 2016 at 12:59 PM, Bram Moolenaar\n<vim-dev-github@256bit.org> wrote:\n>\n>\n> Daniel Hahler wrote:\n>\n>> Here is a test case:\n>>\n>> ```vim\n>> set errorformat=%m\n>> lgetexpr '?'\n>>\n>> try\n>> call DoesNotExit()\n>> catch\n>> lgetexpr '1'\n>> finally\n>> lgetexpr '1'\n>> endtry\n>>\n>> if getloclist(0)[0].text != 1\n>> echoerr 'laddexpr was not called'\n>> endif\n>> ```\n>>\n>> What about using `aborting()` instead of `did_throw || force_abort`?\n>> But even then it seems strange to handle it there like this,\n>> especially for cases where no autocommand has been called (and the\n>> status might not have been checked before, in case some ran\n>> successfully).\n>\n> We can check if apply_autocmds returns TRUE and use aborting().\n> How about this:\n>\n\nYour change looks good to me. I am attaching a diff with your changes\nand the test from Daniel.\n\n- Yegappan\n\ndiff --git a/src/quickfix.c b/src/quickfix.c\nindex 5bd1257..b303b54 100644\n--- a/src/quickfix.c\n+++ b/src/quickfix.c\n@@ -3448,11 +3448,11 @@ ex_make(exarg_T *eap)\n     }\n     if (au_name != NULL)\n     {\n-\tapply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\n-\t\t\t\t\t       curbuf->b_fname, TRUE, curbuf);\n+\tif (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\n+\t\t\t\t\t       curbuf->b_fname, TRUE, curbuf))\n # ifdef FEAT_EVAL\n-\tif (did_throw || force_abort)\n-\t    return;\n+\t    if (aborting())\n+\t\treturn;\n # endif\n     }\n #endif\n@@ -3972,10 +3972,12 @@ ex_vimgrep(exarg_T *eap)\n     }\n     if (au_name != NULL)\n     {\n-\tapply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\n-\t\t\t\t\t       curbuf->b_fname, TRUE, curbuf);\n-\tif (did_throw || force_abort)\n-\t    return;\n+\tif (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\n+\t\t\t\t\t       curbuf->b_fname, TRUE, curbuf))\n+#ifdef FEAT_EVAL\n+\t    if (aborting())\n+\t\treturn;\n+#endif\n     }\n #endif\n \n@@ -4877,11 +4879,11 @@ ex_cbuffer(exarg_T *eap)\n     }\n     if (au_name != NULL)\n     {\n-\tapply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\n-\t\t\t\t\t       curbuf->b_fname, TRUE, curbuf);\n+\tif (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\n+\t\t\t\t\t       curbuf->b_fname, TRUE, curbuf))\n # ifdef FEAT_EVAL\n-\tif (did_throw || force_abort)\n-\t    return;\n+\t    if (aborting())\n+\t\treturn;\n # endif\n     }\n #endif\n@@ -4968,11 +4970,11 @@ ex_cexpr(exarg_T *eap)\n     }\n     if (au_name != NULL)\n     {\n-\tapply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\n-\t\t\t\t\t       curbuf->b_fname, TRUE, curbuf);\n+\tif (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\n+\t\t\t\t\t       curbuf->b_fname, TRUE, curbuf))\n # ifdef FEAT_EVAL\n-\tif (did_throw || force_abort)\n-\t    return;\n+\t    if (aborting())\n+\t\treturn;\n # endif\n     }\n #endif\n@@ -5044,10 +5046,12 @@ ex_helpgrep(exarg_T *eap)\n     }\n     if (au_name != NULL)\n     {\n-\tapply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\n-\t\t\t\t\t       curbuf->b_fname, TRUE, curbuf);\n-\tif (did_throw || force_abort)\n-\t    return;\n+\tif (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,\n+\t\t\t\t\t       curbuf->b_fname, TRUE, curbuf))\n+#ifdef FEAT_EVAL\n+\t    if (aborting())\n+\t\treturn;\n+#endif\n     }\n #endif\n \ndiff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim\nindex 022c12a..118a015 100644\n--- a/src/testdir/test_quickfix.vim\n+++ b/src/testdir/test_quickfix.vim\n@@ -1631,3 +1631,20 @@ function Test_Autocmd()\n \t      \\ 'postcaddbuffer']\n   call assert_equal(l, g:acmds)\n endfunction\n+\n+function! Test_Autocmd_Exception()\n+  set efm=%m\n+  lgetexpr '?'\n+\n+  try\n+    call DoesNotExit()\n+  catch\n+    lgetexpr '1'\n+  finally\n+    lgetexpr '1'\n+  endtry\n+\n+  call assert_equal('1', getloclist(0)[0].text)\n+\n+  set efm&vim\n+endfunction\n"}}
{"actor":{"display_login":"vim-ml"}}