Commit Graph
25623 Commits
Author SHA1 Message Date
Andreas Schneider 9802de9334 fix(userfunc): fix possible out of bound access
In file included from /usr/include/string.h:535,
                 from gsrc/nvim/eval/userfunc.c:11:
In function ‘strcpy’,
    inlined from ‘cat_func_name’ at gsrc/nvim/eval/userfunc.c:662:5,
    inlined from ‘get_user_func_name’ at gsrc/nvim/eval/userfunc.c:2854:5:
/usr/include/bits/string_fortified.h:79:10: warning: ‘__builtin___strcpy_chk’ offset 0 from the object at ‘<unknown>’ is out of the bounds of referenced subobject ‘uf_name’ with ty
pe ‘char[]’ at offset 0 [-Warray-bounds=]
   79 |   return __builtin___strcpy_chk (__dest, __src, __glibc_objsize (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gsrc/nvim/eval/typval.h:10,
                 from gsrc/nvim/buffer_defs.h:20,
                 from gsrc/nvim/autocmd.h:8,
                 from gsrc/nvim/eval/userfunc.c:15:
gsrc/nvim/eval/typval_defs.h: In function ‘get_user_func_name’:
gsrc/nvim/eval/typval_defs.h:342:8: note: subobject ‘uf_name’ declared here
  342 |   char uf_name[];    ///< Name of function (actual size equals name);
      |        ^~~~~~~
2023-04-21 12:14:48 +02:00
Andreas Schneider 2819718873 fix(drawline): initialize variable
src/nvim/drawline.c: In function ‘win_line’:
src/nvim/drawline.c:1418:16: warning: ‘charsize’ may be used uninitialized [-Wmaybe-uninitialized]
 1418 |       wlv.vcol -= charsize;
      |                ^~
2023-04-21 12:14:48 +02:00
Andreas Schneider e9280a68f7 fix(drawline): initialize variable
src/nvim/drawline.c: In function ‘draw_virt_text’:
src/nvim/drawline.c:298:28: warning: ‘col’ may be used uninitialized [-Wmaybe-uninitialized]
  298 |       state->eol_col = col + 1;
      |                        ~~~~^~~
2023-04-21 12:14:47 +02:00
Andreas Schneider ef7ae66eef fix(api): avoid integer truncation
gsrc/nvim/api/vim.c: In function ‘nvim_eval_statusline’:
gsrc/nvim/api/vim.c:2268:55: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 2 [-Wformat-tru
ncation=]
 2268 |         snprintf(user_group, sizeof(user_group), "User%d", sp->userhl);
      |                                                       ^~
gsrc/nvim/api/vim.c:2268:50: note: directive argument in the range [1, 2147483647]
 2268 |         snprintf(user_group, sizeof(user_group), "User%d", sp->userhl);
      |                                                  ^~~~~~~~
In file included from /usr/include/stdio.h:906,
                 from gsrc/nvim/api/vim.c:9:
In function ‘snprintf’,
    inlined from ‘nvim_eval_statusline’ at gsrc/nvim/api/vim.c:2268:9:
/usr/include/bits/stdio2.h:54:10: note: ‘__builtin___snprintf_chk’ output between 6 and 15 bytes into a destination of size 6
   54 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
2023-04-21 12:14:44 +02:00
luukvbaal 05928fe298 docs(gh): suggest distclean in issue template (#23222) 2023-04-21 08:09:11 +01:00
zeertzjqandBram Moolenaar f1b415b3ab vim-patch:9.0.1472: ":drop fname" may change the last used tab page (#23230)
Problem:    ":drop fname" may change the last used tab page.
Solution:   Restore the last used tab page when :drop has changed it.
            (closes vim/vim#12087)

https://github.com/vim/vim/commit/8281a16efc76197f7b0b2a385dffb44fce66d33e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-21 09:02:30 +08:00
bfredl c4fb418626 Merge pull request #23224 from bfredl/nomutex
refactor(env): remove unused mutex
2023-04-20 22:10:15 +02:00
bfredl 230e567a05 Merge pull request #23218 from bfredl/nlua0boogalo
fix(build): distinguish vim.mpack from global require'mpack'
2023-04-20 19:23:44 +02:00
bfredl ffaf74f147 fix(build): distinguish vim.mpack from global require'mpack'
problem: the api of vim.mpack is not compatible with a system provided mpack
solution: don't require 'mpack' directly from the system path
2023-04-20 19:00:38 +02:00
bfredl b773a52515 refactor(env): remove unused mutex
This was needed when TUI was a thread.
lua code uses os_getenv only on the main thread.
2023-04-20 18:54:00 +02:00
William ab2811746e fix(treesitter playground): fix the wrong range of a node displayed i… (#23209)
fix(treesitter playground): wrong range of a node displayed in playground

The call parameters order of the function `get_range_str` is flipped for the last two arguments compared to the declaration.
2023-04-20 07:42:49 -06:00
zeertzjqandBram Moolenaar dbcd1985d1 vim-patch:8.2.4598: profile completion test sometimes fails (#23208)
Problem:    Profile completion test sometimes fails.
Solution:   Delete the .res file before running tests.

https://github.com/vim/vim/commit/7e0be3ea211748a77d32cb1d3d35ecfc246cf0f2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-20 09:17:33 +08:00
bfredl e81331c2b0 Merge pull request #23106 from bfredl/nlua0
refactor(build): use vendored versions of mpack and luabitop
2023-04-19 21:11:12 +02:00
Lewis Russell 706f871014 build: update uncrustify to 0.76 2023-04-19 17:04:00 +01:00
bfredl 3940c435e4 Merge pull request #23155 from bfredl/nobreak
fix(runtime): do not allow breakcheck inside runtime path calculation
2023-04-19 17:07:33 +02:00
zeertzjq ea52961c54 refactor: fix PVS warnings (#23200) 2023-04-19 22:49:14 +08:00
bfredl aee6f08ce1 fix(runtime): do not allow breakcheck inside runtime path calculation
problem: breakcheck might run arbitrary lua code, which might require
modules and thus invoke runtime path calculation recursively.
solution: Block the use of breakcheck when expanding glob patterns
inside 'runtimepath'

fixes #23012
2023-04-19 16:34:15 +02:00
Gregory Anders 0ad5237162 Merge pull request #23198 from gpanders/iter-fix
fix(iter): allow table values in iterator pipelines
2023-04-19 08:23:42 -06:00
zeertzjq 0d7bed34a2 vim-patch:9.0.1470: deferred functions invoked in unexpected order (#23199)
Problem:    Deferred functions invoked in unexpected order when using :qa and
            autocommands.
Solution:   Call deferred functions for the current funccal before using the
            stack. (closes vim/vim#12278)

https://github.com/vim/vim/commit/1be4b81bfb3d7edf0e2ae41711d429e8fa5e0555
2023-04-19 22:09:48 +08:00
Gregory Anders 9489406879 fix(iter): remove special case totable for map-like tables
This was originally meant as a convenience but prevents possible
functionality. For example:

  -- Get the keys of the table with even values
  local t = { a = 1, b = 2, c = 3, d = 4 }
  vim.iter(t):map(function(k, v)
    if v % 2 == 0 then return k end
  end):totable()

The example above would not work, because the map() function returns
only a single value, and cannot be converted back into a table (there
are many such examples like this).

Instead, to convert an iterator into a map-like table, users can use
fold():

  vim.iter(t):fold({}, function(t, k, v)
    t[k] = v
    return t
  end)
2023-04-19 07:52:04 -06:00
Gregory Anders 6b96122453 fix(iter): add tag to packed table
If pack() is called with a single value, it does not create a table; it
simply returns the value it is passed. When unpack is called with a
table argument, it interprets that table as a list of values that were
packed together into a table.

This causes a problem when the single value being packed is _itself_ a
table. pack() will not place it into another table, but unpack() sees
the table argument and tries to unpack it.

To fix this, we add a simple "tag" to packed table values so that
unpack() only attempts to unpack tables that have this tag. Other tables
are left alone. The tag is simply the length of the table.
2023-04-19 07:04:49 -06:00
7bf1a917b7 vim-patch:8.1.2094: the fileio.c file is too big
Problem:    The fileio.c file is too big.
Solution:   Move buf_write() to bufwrite.c. (Yegappan Lakshmanan,
            closes vim/vim#4990)

https://github.com/vim/vim/commit/c079f0fed1c16495d726d616c5362edc04742a0d

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-04-19 13:15:29 +01:00
zeertzjq ccc939ec10 Merge pull request #23194 from zeertzjq/vim-9.0.1141
vim-patch:9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
2023-04-19 18:21:43 +08:00
bfredl 1e60e8c040 refactor(build): use vendored versions of mpack and luabitop 2023-04-19 10:44:25 +02:00
zeertzjq 14caad32b6 test: convert tests in test_conceal.vim to Lua 2023-04-19 16:23:08 +08:00
zeertzjqandAlexey Radkov 8bed07357d vim-patch:9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Problem:    'cursorcolumn' and 'colorcolumn' wrong after concealing and
            wrapping line.
Solution:   Reset "wlv.vcol_off" after each screen line. (Alexey Radkov,
            closes vim/vim#11777)

https://github.com/vim/vim/commit/aaa16b09180080284c4a5049fe16bdaccbb13b74

Cherry-pick test_conceal.vim changes from patches 8.2.4339, 9.0.0418.

Co-authored-by: Alexey Radkov <alexey.radkov@gmail.com>
2023-04-19 16:23:08 +08:00
Christian Clasonanddundargoc cff02e993d vim-patch:9.0.1467: Jenkinsfiles are not recognized as groovy (#23195)
Problem:    Jenkinsfiles are not recognized as groovy.
Solution:   Add a pattern for Jenkinsfiles. (closes vim/vim#12236)

https://github.com/vim/vim/commit/142ffb024dd5123090c2fd02f55702e76520f1df

Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-04-19 10:19:33 +02:00
Christian ClasonandFederico Mengozzi 6d9f5b6bf0 vim-patch:9.0.1464: strace filetype detection is expensive (#23175)
Problem:    Strace filetype detection is expensive.
Solution:   Match with a cheap pattern first. (Federico Mengozzi,
            closes vim/vim#12220)

https://github.com/vim/vim/commit/6e5a9f948221b52caaaf106079cb3430c4dd7c77

Co-authored-by: Federico Mengozzi <19249682+fedemengo@users.noreply.github.com>
2023-04-19 09:41:26 +02:00
zeertzjq 95c6e1b741 test(terminal/channel_spec): fix screen test immediate success (#23192)
Check for the [No Name] after wiping the buffer.
2023-04-19 12:10:06 +08:00
zeertzjq c218109744 Merge pull request #23191 from zeertzjq/vim-9.0.1007
vim-patch:9.0.{0369,0372,0426,0514,0545,0560,0561,1005,1007,1008,1009,1010,1012,1020,1021,1034}
2023-04-19 12:06:45 +08:00
zeertzjq 1c12f844ad refactor(eval): use tv_list_append_allocated_string() 2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar 519acb3ec1 vim-patch:9.0.1034: reporting swap file when windows are split
Problem:    Reporting swap file when windows are split.
Solution:   Close extra windows after running a test.

https://github.com/vim/vim/commit/e5eae82bb7199bd71c6216269e78c69e9a793c8f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar b9bf1b1294 vim-patch:9.0.1021: test trips over g:name
Problem:    Test trips over g:name.
Solution:   Delete g:name after using it.

https://github.com/vim/vim/commit/d6e74f547910d5273a3b99c23fb3197131c7d379

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar 5f4e0a005b vim-patch:9.0.1020: tests call GetSwapFileList() before it is defined
Problem:    Tests call GetSwapFileList() before it is defined.
Solution:   Move the call to after defining the function. (Christopher
            Plewright)

https://github.com/vim/vim/commit/6572a90287c7aa6e8042b18604891e9df3657245

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar ab7bd119d7 vim-patch:9.0.1012: tests may get stuck in buffer with swap file
Problem:    Tests may get stuck in buffer with swap file.
Solution:   Bail out when bwipe! doesn't get another buffer.

https://github.com/vim/vim/commit/fa2533c8bb96abcec29b9dc6bd4fe7054c7c7e50

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar a2f4bad781 vim-patch:9.0.1010: stray warnings for existing swap files
Problem:    Stray warnings for existing swap files.
Solution:   Wipe out the buffer until it has no name and no swap file.

https://github.com/vim/vim/commit/23526d2539e8679ea8df14e3a018101dedc3f391

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar a0d4649c17 vim-patch:9.0.1009: test for catch after interrupt is flaky on MS-Windows
Problem:    Test for catch after interrupt is flaky on MS-Windows.
Solution:   Mark the test as flaky.

https://github.com/vim/vim/commit/72b5b0d51aa9ddf8d338a5a133a667a3c2392ae1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar 94a7ccea43 vim-patch:9.0.1008: test for swapfilelist() fails on MS-Windows
Problem:    Test for swapfilelist() fails on MS-Windows.
Solution:   Only check the tail of the path.  Mark a test as flaky.

https://github.com/vim/vim/commit/6cf3151f0e3839332c89367b7384c395a1185927

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar 85c61d6716 vim-patch:9.0.1007: there is no way to get a list of swap file names
Problem:    There is no way to get a list of swap file names.
Solution:   Add the swapfilelist() function.  Use it in the test script to
            clean up.  Remove deleting individual swap files.

https://github.com/vim/vim/commit/c216a7a21a25a701b84b79abc1ba6ab0baa3a311

vim-patch:9.0.1005: a failed test may leave a swap file behind

Problem:    A failed test may leave a swap file behind.
Solution:   Delete the swap file to avoid another test to fail.  Use another
            file name.

https://github.com/vim/vim/commit/d0f8d39d20f8d42f7451f781f7be0bcd20e06741

Cherry-pick test_window_cmd.vim changes from patch 8.2.1593.
Remove FUNC_ATTR_UNUSED from eval functions as fptr is always unused.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar d82a6ca72a vim-patch:9.0.0561: when a test gets stuck it just hangs forever
Problem:    When a test gets stuck it just hangs forever.
Solution:   Set a timeout of 30 seconds.

https://github.com/vim/vim/commit/3bcd0ddc2deb34794c735c6ea0b8f964b510c6db

Note: This doesn't cause test_timers.vim failures in Nvim because there
is a SetUp() function that calls timer_stopall().

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar 63432c854f vim-patch:9.0.0560: elapsed time since testing started is not visible
Problem:    Elapsed time since testing started is not visible.
Solution:   Show the elapsed time while running tests.

https://github.com/vim/vim/commit/b9093d50098ccff3848c2a404b9d0324a074c7b7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar 7592540029 vim-patch:9.0.0545: when a test is slow and CI times out there is no time info
Problem:    When a test is slow and CI times out there is no time info.
Solution:   Add the elapsed time to the "Executing" message.

https://github.com/vim/vim/commit/daaa3d9965d74faf1f75aea218822bfb7ba687a7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar db12c61c56 vim-patch:9.0.0514: terminal test sometimes hangs
Problem:    Terminal test sometimes hangs.
Solution:   Add a bit more information to the test output. (issue vim/vim#11179)

https://github.com/vim/vim/commit/a22c56a59a1e60f6976e61d16001623424a26b3a

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar ad06c1c1c6 vim-patch:9.0.0426: failed flaky tests reports only start time
Problem:    Failed flaky tests reports only start time.
Solution:   Also report the end time.

https://github.com/vim/vim/commit/65258d36ddfab371c7982343efc9b2533ba39075

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar c4c5bcd2b2 vim-patch:9.0.0372: MS-Windows: "%T" time format does not appear to work
Problem:    MS-Windows: "%T" time format does not appear to work.
Solution:   Use "%H:%M:%S" instead.

https://github.com/vim/vim/commit/5fbbec180b623cd6ebfc9528be6fa70b4cf664d4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
zeertzjqandBram Moolenaar db6812c444 vim-patch:9.0.0369: a failing flaky test doesn't mention the time
Problem:    A failing flaky test doesn't mention the time.
Solution:   Add the time for debugging.  Improve error message.

https://github.com/vim/vim/commit/06d32a0c177e4166ff0491668cd459464bc2ef45

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:33 +08:00
zeertzjq dd8781128f Merge pull request #23188 from zeertzjq/vim-9.0.1462
vim-patch:9.0.{1462,1468,1469}: :defer fixes
2023-04-19 08:35:27 +08:00
zeertzjq a0c982671e vim-patch:9.0.1469: deferred functions not called from autocommands
Problem:    Deferred functions not called from autocommands.
Solution:   Also go through the funccal_stack. (closes vim/vim#12267)

https://github.com/vim/vim/commit/960cf9119e3f4922ca9719feb5e0c0bc5e3b9840
2023-04-19 08:09:46 +08:00
zeertzjq a11849abdf vim-patch:9.0.1468: recursively calling :defer function if it does :qa
Problem:    Recursively calling :defer function if it does :qa in a compiled
            function.
Solution:   Clear the defer entry before calling the function. (closes vim/vim#12271)

https://github.com/vim/vim/commit/a1f2b5ddc63d4e2b6ab047d8c839dd8477b36aba
2023-04-19 08:09:46 +08:00
zeertzjqandBram Moolenaar 8e0ad6e261 vim-patch:9.0.1462: recursively calling :defer function if it does :qa
Problem:    Recursively calling :defer function if it does :qa.
Solution:   Clear the defer entry before calling the function. (closes vim/vim#12266)

https://github.com/vim/vim/commit/42994bf678f46dc9ca66e49f512261da8864fff6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 08:09:46 +08:00