aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* test: fnamemodify()Justin M. Keyes2018-01-28
|
* test/win: fix some environment assumptions #7912George Zhao2018-01-28
| | | | | fix #7909 fix #7910
* Merge #7903 'test/old: minor fixes for local invocation'Justin M. Keyes2018-01-28
|\
| * test/old: always set $TMPDIRJustin M. Keyes2018-01-23
| | | | | | | | | | | | On macOS $TMPDIR defaults to something very long. There's not really a need to support overriding the $TMPDIR used by tests, so always use the workspace-local path "Xtest-tmpdir".
| * test/old: Fix_truncated_tmpfile(): more flexibleJustin M. Keyes2018-01-23
| |
* | tui: fix use-after-free after UI `stop` event #7922Justin M. Keyes2018-01-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ui_bridge:ui_bridge_stop() calls ui_detach_impl() last, so the check for ui_active() in ui:ui_refresh() doesn't help: tui_main() already freed the `ui` object. There is a race between ui_bridge_stop (thread T0) and tui_main (thread T1). UIBridgeData.stopped could be set while ui_bridge_stop() is in the middle of loop_poll_events(), which may invoke tui_scheduler() on T0. The pointers in tui_scheduler() may be invalid by then. Solution(?): Use the `UI.data` field as a "stopped" flag and check it in tui_scheduler(). ASAN use-after-free report observed in #7908: = ==20066==ERROR: AddressSanitizer: heap-use-after-free on address 0x611000000cd0 at pc 0x00000182abed bp 0x7ffe23b07070 sp 0x7ffe23b07068 = READ of size 8 at 0x611000000cd0 thread T0 = 0 0x182abec in tui_scheduler /home/travis/build/neovim/neovim/src/nvim/tui/tui.c:393:23 = 1 0x1876afd in ui_bridge_update_fg /home/travis/build/neovim/neovim/build/src/nvim/auto/ui_events_bridge.generated.h:205:3 = 2 0x186c130 in ui_resize /home/travis/build/neovim/neovim/src/nvim/ui.c:310:3 = 3 0x146b9c2 in screen_resize /home/travis/build/neovim/neovim/src/nvim/screen.c:7483:3 = 4 0x186a6f0 in ui_refresh /home/travis/build/neovim/neovim/src/nvim/ui.c:284:3 = 5 0x186bbe0 in ui_refresh_event /home/travis/build/neovim/neovim/src/nvim/ui.c:297:3 = 6 0xa2219a in multiqueue_process_events /home/travis/build/neovim/neovim/src/nvim/event/multiqueue.c:150:7 = 7 0xa1bd7f in loop_poll_events /home/travis/build/neovim/neovim/src/nvim/event/loop.c:63:3 = 8 0x1872709 in ui_bridge_stop /home/travis/build/neovim/neovim/src/nvim/ui_bridge.c:121:5 = 9 0x1864247 in ui_builtin_stop /home/travis/build/neovim/neovim/src/nvim/ui.c:143:3 = 10 0x1249ec8 in mch_exit /home/travis/build/neovim/neovim/src/nvim/os_unix.c:140:3 = 11 0xe56ba9 in getout /home/travis/build/neovim/neovim/src/nvim/main.c:671:3 = 12 0xfc4c8f in preserve_exit /home/travis/build/neovim/neovim/src/nvim/misc1.c:2653:3 = 13 0x1247c02 in deadly_signal /home/travis/build/neovim/neovim/src/nvim/os/signal.c:137:3 = 14 0x1247921 in on_signal /home/travis/build/neovim/neovim/src/nvim/os/signal.c:162:9 = 15 0xa35618 in signal_event /home/travis/build/neovim/neovim/src/nvim/event/signal.c:47:3 = 16 0xa2219a in multiqueue_process_events /home/travis/build/neovim/neovim/src/nvim/event/multiqueue.c:150:7 = 17 0xa1bd7f in loop_poll_events /home/travis/build/neovim/neovim/src/nvim/event/loop.c:63:3 = 18 0x1237bd6 in input_poll /home/travis/build/neovim/neovim/src/nvim/os/input.c:349:3 = 19 0x123334f in inbuf_poll /home/travis/build/neovim/neovim/src/nvim/os/input.c:372:24 = 20 0x123316d in os_inchar /home/travis/build/neovim/neovim/src/nvim/os/input.c:110:19 = 21 0x170d20e in state_enter /home/travis/build/neovim/neovim/src/nvim/state.c:55:13 = 22 0xbd7441 in command_line_enter /home/travis/build/neovim/neovim/src/nvim/ex_getln.c:384:3 = 23 0xbd0a60 in getcmdline /home/travis/build/neovim/neovim/src/nvim/ex_getln.c:1920:10 = 24 0xbdb365 in getexline /home/travis/build/neovim/neovim/src/nvim/ex_getln.c:2100:10 = 25 0xb00a6b in do_cmdline /home/travis/build/neovim/neovim/src/nvim/ex_docmd.c:528:47 = 26 0x10a7837 in nv_colon /home/travis/build/neovim/neovim/src/nvim/normal.c:4552:18 = 27 0x1091e15 in normal_execute /home/travis/build/neovim/neovim/src/nvim/normal.c:1136:3 = 28 0x170d439 in state_enter /home/travis/build/neovim/neovim/src/nvim/state.c:67:26 = 29 0x104ee14 in normal_enter /home/travis/build/neovim/neovim/src/nvim/normal.c:466:3 = 30 0xe4295c in main /home/travis/build/neovim/neovim/src/nvim/main.c:572:3 = 31 0x2b2ba340bf44 in __libc_start_main /build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:287 = 32 0x44d24b in _start (/home/travis/build/neovim/neovim/build/bin/nvim+0x44d24b) = = 0x611000000cd0 is located 16 bytes inside of 240-byte region [0x611000000cc0,0x611000000db0) = freed by thread T1 here: = 0 0x4ee0e2 in __interceptor_free /local/mnt/workspace/tmp/ubuntu_rel/llvm/utils/release/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:47:3 = 1 0xf4f6d4 in xfree /home/travis/build/neovim/neovim/src/nvim/memory.c:133:3 = 2 0x182a963 in tui_main /home/travis/build/neovim/neovim/src/nvim/tui/tui.c:383:3 = 3 0x18792b0 in ui_thread_run /home/travis/build/neovim/neovim/src/nvim/ui_bridge.c:106:3 = 4 0x2b2ba2697183 in start_thread /build/eglibc-ripdx6/eglibc-2.19/nptl/pthread_create.c:312 = = previously allocated by thread T0 here: = 0 0x4ee61a in calloc /local/mnt/workspace/tmp/ubuntu_rel/llvm/utils/release/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:76:3 = 1 0xf4f787 in xcalloc /home/travis/build/neovim/neovim/src/nvim/memory.c:147:15 = 2 0x182000a in tui_start /home/travis/build/neovim/neovim/src/nvim/tui/tui.c:127:12 = 3 0x1863f7c in ui_builtin_start /home/travis/build/neovim/neovim/src/nvim/ui.c:125:3 = 4 0xe41bb9 in main /home/travis/build/neovim/neovim/src/nvim/main.c:457:5 = 5 0x2b2ba340bf44 in __libc_start_main /build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:287 = = Thread T1 created by T0 here: = 0 0x4d774d in __interceptor_pthread_create /local/mnt/workspace/tmp/ubuntu_rel/llvm/utils/release/final/llvm.src/projects/compiler-rt/lib/asan/asan_interceptors.cc:317:3 = 1 0x1aae6b0 in uv_thread_create /home/travis/nvim-deps/build/src/libuv/src/unix/thread.c:75 = 2 0x18217fa in tui_start /home/travis/build/neovim/neovim/src/nvim/tui/tui.c:159:10 = 3 0x1863f7c in ui_builtin_start /home/travis/build/neovim/neovim/src/nvim/ui.c:125:3 = 4 0xe41bb9 in main /home/travis/build/neovim/neovim/src/nvim/main.c:457:5 = 5 0x2b2ba340bf44 in __libc_start_main /build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:287 --- Alternative attempt: commit 6ad9c02491606a0c31e907f38c9931f324327aa5 Author: Justin M. Keyes <justinkz@gmail.com> Date: Sat Jan 27 15:12:58 2018 +0100 tui: fix use-after-free: swap in empty scheduler This should make life easier for UIs like VimR which implement their own in-process bridged UI: they don't need to worry that their `scheduler` might receive an invalid pointer. To avoid that, ui_bridge_stopped() swaps in an empty scheduler. Note that this requires the call to loop_poll_events() to be moved into the critical section. diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c index 779585416f80..491052d19d3b 100644 --- a/src/nvim/ui_bridge.c +++ b/src/nvim/ui_bridge.c @@ -93,10 +93,18 @@ UI *ui_bridge_attach(UI *ui, ui_main_fn ui_main, event_scheduler scheduler) return &rv->bridge; } +static void ui_bridge_null_scheduler(Event event, void *d) +{ + WLOG("ignoring event (bridge stopped)"); +} + void ui_bridge_stopped(UIBridgeData *bridge) { uv_mutex_lock(&bridge->mutex); bridge->stopped = true; + // Replace with an empty scheduler, so that the UI internal scheduler does + // not get invoked with an invalid pointer. #7922 + bridge->scheduler = ui_bridge_null_scheduler; uv_mutex_unlock(&bridge->mutex); } @@ -111,14 +119,11 @@ static void ui_bridge_stop(UI *b) UIBridgeData *bridge = (UIBridgeData *)b; bool stopped = bridge->stopped = false; UI_BRIDGE_CALL(b, stop, 1, b); - for (;;) { + while (!stopped) { uv_mutex_lock(&bridge->mutex); stopped = bridge->stopped; - uv_mutex_unlock(&bridge->mutex); - if (stopped) { - break; - } loop_poll_events(&main_loop, 10); // Process one event (at most). + uv_mutex_unlock(&bridge->mutex); } uv_thread_join(&bridge->ui_thread); uv_mutex_destroy(&bridge->mutex);
* | Merge #7919 from hardenedapple/langremap-after-mapJustin M. Keyes2018-01-27
|\ \
| * | Make 'langnoremap' apply directly after a mapMatthew Malcomson2018-01-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were initially checking whether to apply 'langmap' translation based on typebuf.tb_maplen. This gets set to 0 on the last byte of a map when the del_typebuf() function is called, which means that the option was not working for the last character of a mapping. For this reason, we switched to using KeyTyped to decide whether to apply the transformation or not in commit 53da57d27. Substituting one for the other isn't enough, because KeyTyped isn't set until vgetorpeek() is returning. This means 'langmap' translations are not applied when searching for characters to map in the vgetorpeek() function if the *previous* key was not typed. We can't assert that both hold, as we would then *not* apply the transformation when looking for a map starting with the first typed key after a previously expanded map (as KeyTyped would be `false` from the previously expanded map, and not yet reset). Hence we assert that if we are looking for the mapping while in vgetorpeek(), the map length should be zero, otherwise, KeyTyped must be `true`. This is implemented by checking for the variable `vgetc_busy`.
| * | Add some tests for 'langmap'Matthew Malcomson2018-01-27
| | |
* | | build/macOS: remove -iframework line #7891Justin M. Keyes2018-01-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linker error: [1/3] Linking C executable bin/nvim ld: warning: directory not found for option '-FCoreFoundation' Only the -isysroot change is needed, see https://github.com/neovim/neovim/pull/7891#discussion_r164036958
* | | Merge pull request #6558 from jamessan/tv_as_string-fixJames McCoy2018-01-25
|\ \ \ | | | | | | | | eval: save_tv_as_string: Correctly handle an empty string
| * | | eval: save_tv_as_string: Correctly handle an empty stringJames McCoy2018-01-23
| | |/ | |/| | | | | | | | | | | | | | | | | | | When tv_get_string_chk returns a non-NULL value, we have a valid string. Propagating an error state (*len = -1, NULL return) for an empty string is invalid. Closes #6554
* | | vim-patch:8.0.0431 (#7908)KunMing Xie2018-01-25
| | | | | | | | | | | | | | | | | | | | | vim-patch:8.0.0431: 'cinoptions' cannot set indent for extern block Problem: 'cinoptions' cannot set indent for extern block. Solution: Add the "E" flag in 'cinoptions'. (Hirohito Higashi) https://github.com/vim/vim/commit/7720ba8599162fbbb8f7fc034f674a2ccd3ca7f1
* | | build: fix luacheck detection (avoids re-download on win32) (#7905)George Zhao2018-01-24
|/ /
* / test: system(): fix testJustin M. Keyes2018-01-23
|/ | | | | | | For the test to be valid it should actually send input. ref #3529 ref #5241
* Merge pull request #7894 from jamessan/cmake-cmp0026-fixJames McCoy2018-01-23
|\ | | | | cmake: Use generator expression to determine libnvim-test path
| * cmake: Use generator expression to determine libnvim-test pathJames McCoy2018-01-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to CMake 2.8.12, generator expressions could only be used in custom commands so the path to libnvim-test in test/config/paths.lua was set by inspecting the target's LOCATION property. Post 2.8.12, the file(GENERATE) command exists to handle this, but it can't interpolate normal CMake variables. In order to bridge the gap while < 2.8.12 is supported, use configure_file() to create paths.lua.gen with the $<TARGET_FILE:nvim-test> generator expression and then generate the final paths.lua file. Closes #7077
* | test/inccommand_spec: test the test (#7897)Justin M. Keyes2018-01-23
| |
* | Merge #7890 'vim-patch: various'Justin M. Keyes2018-01-22
|\ \
| * | vim-patch: NAJustin M. Keyes2018-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vim-patch:8.0.0674: cannot build with eval but without timers vim-patch:8.0.0673: build failure without conceal feature vim-patch:8.0.0668: nsis installer script does not work vim-patch:8.0.0666: dead for loop vim-patch:8.0.0665: warning for uninitialized variable vim-patch:8.0.0664: mouse does not work in tmux vim-patch:8.0.0661: recognizing urxvt mouse codes does not work well vim-patch:8.0.0660: silent install on MS-Windows shows dialog
| * | vim-patch:8.0.0667: more tests for :endfuncJustin M. Keyes2018-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | [Only the test is merged; code was addressed by 60c025267265.] Problem: Memory access error when command follows :endfunction. (Nikolai Pavlov) Solution: Make memory handling in :function straightforward. (closes vim/vim#1793) https://github.com/vim/vim/commit/53564f7c1a2998d92568e07fff1f2a4c1cecb646
| * | vim-patch:8.0.0662: stray FIXME for fixed problemJustin M. Keyes2018-01-21
| | | | | | | | | | | | | | | | | | | | | Problem: Stray FIXME for fixed problem. Solution: Remove the comment. (Dominique Pelle) https://github.com/vim/vim/commit/4670490673ed98502a09b74fbabe785b47e3d289
| * | vim-patch:8.0.0659: no test for conceal modeJustin M. Keyes2018-01-21
| | | | | | | | | | | | | | | | | | | | | Problem: No test for conceal mode. Solution: Add a conceal mode test. (Dominique Pelle, closes vim/vim#1783) https://github.com/vim/vim/commit/4d785895d1f8b54cdd3fabd87446ca692f49e94e
| * | vim-patch:8.0.0656: cannot use ! after some user commandsJustin M. Keyes2018-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | [Test passes, and the code change doesn't look applicable. So this only includes the test.] Problem: Cannot use ! after some user commands. Solution: Properly check for existing command. (Higashi Higashi) https://github.com/vim/vim/commit/6f9a476b2f2f0bb5c50d703ec4fc535ffd5bfe8f
| * | vim-patch:8.0.0655: not easy to make sure a function does not existJustin M. Keyes2018-01-21
| | | | | | | | | | | | | | | | | | | | | Problem: Not easy to make sure a function does not exist. Solution: Add ! as an optional argument to :delfunc. https://github.com/vim/vim/commit/d6abcd154cdc6a8dd4b7c6ccad37617ea8a1b4aa
| * | vim-patch:8.0.0654: no warning for text after :endfunctionJustin M. Keyes2018-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Text found after :endfunction is silently ignored. Solution: Give a warning if 'verbose' is set. When | or \n are used, execute the text as a command. https://github.com/vim/vim/commit/663bb2331626944cea156374858131fcd323b9e9 Note: the code part of this patch was addressed by 60c025267265.
* | | Merge #7891 'build: fix creating generated files on macOS'Justin M. Keyes2018-01-22
|\ \ \ | |_|/ |/| |
| * | build: fix creating generated files on macOSJohn Szakmeister2018-01-22
| |/ | | | | | | | | | | | | For some reason, using the clang executable inside of the Xcode default toolchain the platform's sysroot include isn't present. This was debugged by adding "-###" on the command line for generating the header for nvim/os/lang.c and is was evident the flag was missing.
* | Merge #7893 'man.vim: use correct offset in presence of modifier commands'Marco Hinz2018-01-22
|\ \
| * | man.vim: use correct offset in presence of modifier commandsMarco Hinz2018-01-22
|/ / | | | | | | | | | | | | | | | | | | | | The argument expansion for :Man depends on the number of arguments given to it starting at the command itself. But user completion functions always provide the entire command-line which can include modifier commands like :tab, :vert, etc. leading to a wrong number of arguments. Prune all arguments up to :Man. Fixes #7872.
* | Merge #7888 'defaults: enable cscopeverbose'Justin M. Keyes2018-01-22
|\ \ | |/ |/|
| * defaults: enable 'cscopeverbose', and deprecate itJustin M. Keyes2018-01-21
| |
| * doc: if_cscop: cleanupJustin M. Keyes2018-01-21
| |
* | Merge #7885 'vim-patch: diff-related patches'Justin M. Keyes2018-01-21
|\ \ | |/ |/|
| * vim-patch:8.0.0444: diffpatch fails when the file name has a quoteJustin M. Keyes2018-01-21
| | | | | | | | | | | | | | Problem: Diffpatch fails when the file name has a quote. Solution: Escape the name properly. (zetzei) https://github.com/vim/vim/commit/a95ab321200f0239991bf53756b17cd7b90745f9
| * vim-patch:8.0.0442: patch shell command not well escapedJustin M. Keyes2018-01-21
| | | | | | | | | | | | | | | | Problem: Patch shell command uses double quotes around the argument, which allows for $HOME to be expanded. (Etienne) Solution: Use single quotes on Unix. (closes vim/vim#1543) https://github.com/vim/vim/commit/1ef73e33c9414eb02c229d8234aafd9d481a8856
| * vim-patch:8.0.0433: beeps when running testsJustin M. Keyes2018-01-21
| | | | | | | | | | | | | | Problem: Quite a few beeps when running tests. Solution: Set 'belloff' for these tests. (Christian Brabandt) https://github.com/vim/vim/commit/c3c766ea8c35f5b2bd45fb3d74d0ae46b2d8c24f
| * vim-patch:8.0.0599: diff mode is insufficiently testedJustin M. Keyes2018-01-21
|/ | | | | | | | | | | | | | | Problem: diff mode is insufficiently tested Solution: Add more test cases. (Dominique Pelle, closes vim/vim#1685) https://github.com/vim/vim/commit/79a213d6a4e909703524a7f1ad985c7bd40650a6 NA / already applied: --------------------- vim-patch:8.0.0421: diff mode wrong when adding line at end of buffer Problem: Diff mode is displayed wrong when adding a line at the end of a buffer. Solution: Adjust marks in diff mode. (James McCoy, closes vim/vim#1329) https://github.com/vim/vim/commit/f58a8475e17bd566760fc7e2a17d35ddf4edacf2
* vim-patch:8.0.0301 #7685ckelsel2018-01-21
| | | | | | | | | | | | Problem: No tests for ":set completion" and various errors of the :set command. Solution: Add more :set tests. (Dominique Pelle, closes vim/vim#1440) https://github.com/vim/vim/commit/698f8b207bbfefa1cbbd7361caf5412cb3416534 --- Also move test_options from test_alot to Makefile. (That's done upstream in Vim patch 8.0.0430.)
* version.c: update [ci skip] (#7828)Marvim the Paranoid Android2018-01-21
|
* ui: forward 'linespace' option #7883Justin M. Keyes2018-01-21
| | | | ref #7520
* Merge #7880 'lua/executor: Remove lightuserdata'Justin M. Keyes2018-01-21
|\
| * lua/executor: Remove all places where lightuserdata is usedZyX2018-01-21
| | | | | | | | | | | | Should fix problems with luajit+arm64. Fixes #7879 Ref LuaJIT/LuaJIT#230
* | vim-patch:8.0.0426: insufficient testing for statusline (#7882)KunMing Xie2018-01-21
|/ | | | | | Problem: Insufficient testing for statusline. Solution: Add several tests. (Dominique Pelle, closes vim/vim#1534) https://github.com/vim/vim/commit/300af82eca3dd5fec6be5516f16c9fd344ae104b
* Merge #7863 'mingw64: fix gcc warnings'Justin M. Keyes2018-01-20
|\
| * Fix lint error in option.cGeorge Zhao2018-01-19
| |
| * Fix for lintGeorge Zhao2018-01-19
| |
| * Fix warning: multi-line comment [-Wcomment] use `:341,355s/: ↵George Zhao2018-01-19
| | | | | | | | \zs.*/\=string(submatch(0))`
| * Fix warning, read/write have unsigned int count on windows.George Zhao2018-01-19
| |
| * Fix warning about NULL compareGeorge Zhao2018-01-18
| |