summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/os/shell.c
AgeCommit message (Collapse)AuthorFiles
2026-04-14build: update clang v21, fix warningsdundargoc1
- `src/nvim/ex_cmds_defs.h`: use "U" instead of "u" per `readability-uppercase-literal-suffix`
2026-04-06fix(events): avoid recursive loop_uv_run() from vim.ui_attach() shell messageLuuk van Baal1
Problem: vim.ui_attach() msg_show callback runs the risk of a recursive loop_uv_run() when trying to display a message from a shell command stream. Solution: Schedule the message callback on the fast_events queue.
2026-04-05fix(windows): force console codepage to UTF-8 for shell/system() #38742Elijah Koulaxis1
Problem: On Windows, `:!echo тест` shows `????` because the console code page defaults to a legacy ANSI encoding (e.g. CP1252) instead of `UTF-8` Solution: Call `SetConsoleOutputCP(CP_UTF8)` and `SetConsoleCP(CP_UTF8)` in `do_os_system()` before spawning child processes, and restore the original values after. It covers both `:!` and `system()` since they both go through `do_os_system()`
2026-03-20vim-patch:9.2.0202: [security]: command injection via newline in glob() (#38385)zeertzjq1
Problem: The glob() function on Unix-like systems does not escape newline characters when expanding wildcards. A maliciously crafted string containing '\n' can be used as a command separator to execute arbitrary shell commands via mch_expand_wildcards(). This depends on the user's 'shell' setting. Solution: Add the newline character ('\n') to the SHELL_SPECIAL definition to ensure it is properly escaped before being passed to the shell (pyllyukko). closes: vim/vim#19746 Github Advisory: https://github.com/vim/vim/security/advisories/GHSA-w5jw-f54h-x46c https://github.com/vim/vim/commit/645ed6597d1ea896c712cd7ddbb6edee79577e9a Co-authored-by: pyllyukko <pyllyukko@maimed.org>
2026-03-09fix(messages): non-fast and append for "shell_*" kinds #38188luukvbaal1
Problem: vim.ui_attach() is unable to display streamed shell output, and will display it as individual messages. Unwanted newlines in "shell_ret" message. Solution: Treat the "shell_*" kinds as non-fast and set msg_show->append for the streamed stdout/err messages. Remove leading newline from (translated) message with ext_messages, remove trailing newline altogether.
2026-02-22vim-patch:9.2.0031: Inefficient use of ga_concat()zeertzjq1
Problem: Inefficient use of ga_concat() Solution: Use ga_concat_len() when the length is already known to avoid use of strlen() (John Marriott). closes: vim/vim#19422 https://github.com/vim/vim/commit/ed202035b1904c84d92adb76d7e1a95b7540e048 Co-authored-by: John Marriott <basilisk@internode.on.net> Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2026-02-19fix(rpc): include write failure reason in log (#37959)zeertzjq1
Also don't use LOGLVL_ERR on UV_EPIPE.
2026-01-07docs: misc (#37280)zeertzjq1
Close #36806 Close #36812 Close #37003 Close #37016 Close #37038 Close #37039 Close #37157 Close #37185 Close #37213 Co-authored-by: saroj_r <sarojregmi.official@gmail.com> Co-authored-by: Olivia Kinnear <git@superatomic.dev> Co-authored-by: Igor <igorlfs@ufmg.br> Co-authored-by: Justin Roberts <JustinEdwardLeo@gmail.com> Co-authored-by: "Mike J. McGuirk" <mike.j.mcguirk@gmail.com> Co-authored-by: Aymen Hafeez <49293546+aymenhafeez@users.noreply.github.com> Co-authored-by: Peter Cardenas <16930781+PeterCardenas@users.noreply.github.com> Co-authored-by: DrNayak2306 <dhruvgnk.work@gmail.com>
2025-12-04vim-patch:9.1.1947: [security]: Windows: Vim may execute commands from ↵zeertzjq1
current directory Problem: [security]: Windows: Vim may execute commands from current directory (Simon Zuckerbraun) Solution: Set the $NoDefaultCurrentDirectoryInExePath before running external commands. Github Advisory: https://github.com/vim/vim/security/advisories/GHSA-g77q-xrww-p834 https://github.com/vim/vim/commit/083ec6d9a3b7b09006e0ce69ac802597d25856d6 Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-10-31Merge pull request #36393 from zeertzjq/rstream-close-cbzeertzjq1
fix(channel): closing socket with pending writes leaks memory
2025-10-10vim-patch:8.2.4772: old Coverity warning for not checking ftell() return valueJan Edmund Lazo1
Problem: Old Coverity warning for not checking ftell() return value. Solution: Check return value of fseek() and ftell(). https://github.com/vim/vim/commit/3df8f6e353eeaf24bb5fe3769ed07c03791bb58e Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-04vim-patch:partial:8.1.1939: code for handling v: variables in generic eval ↵Jan Edmund Lazo1
file (#35968) Problem: Code for handling v: variables in generic eval file. Solution: Move v: variables to evalvars.c. (Yegappan Lakshmanan, closes vim/vim#4872) https://github.com/vim/vim/commit/e5cdf153bcb348c68011b308c8988cea42d6ddeb Remove direct reference to "vimvars" for following functions: - assert_error() - get_vim_var_nr() - get_vim_var_list() - get_vim_var_dict() - get_vim_var_str() - set_cmdarg() - set_reg_var() - set_vcount() - set_vexception() - set_vthrowpoint() - set_vim_var_bool() - set_vim_var_dict() - set_vim_var_list() - set_vim_var_nr() - set_vim_var_special() - set_vim_var_string() - set_vim_var_type() Reorder functions based on v8.2.4930 for eval_one_expr_in_str() and eval_all_expr_in_str(). Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-14refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guardsbfredl1
These are not needed after #35129 but making uncrustify still play nice with them was a bit tricky. Unfortunately `uncrustify --update-config-with-doc` breaks strings with backslashes. This issue has been reported upstream, and in the meanwhile auto-update on every single run has been disabled.
2025-05-25fix(system): don't treat NUL at start as no input (#34167)zeertzjq1
2025-05-02feat(messages): hl-StderrMsg, hl-StdoutMsg #33429Sathya Pramodh1
Problem: stderr messages from executing ":!cmd" show up with highlight hl-ErrorMsg. But some shell utilites use stderr for debug logging, progress updates, etc. Solution: Highlight shell command outputs hl-StderrMsg and hl-StdoutMsg.
2025-04-30feat(terminal): parse current buffer contents in nvim_open_term() (#33720)Gregory Anders1
When nvim_open_term() is called with a non-empty buffer, the buffer contents are piped into the PTY.
2025-04-12feat(defaults): shelltemp=false #33012Alexej Kowalew1
Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-03-30vim-patch:9.1.1260: Hang when filtering buffer with NUL bytes (#33192)zeertzjq1
Problem: Hang when filtering buffer with NUL bytes (after 9.1.1050). Solution: Don't subtract "written" from "lplen" repeatedly (zeertzjq). related: neovim/neovim#33173 closes: vim/vim#17011 https://github.com/vim/vim/commit/53fed23cb7bd59d9400961b44c6c8dca0029c929
2025-01-24vim-patch:partial:9.1.1050: too many strlen() calls in os_unix.c (#32188)zeertzjq1
Problem: too many strlen() calls in os_unix.c Solution: refactor os_unix.c and remove calls to strlen() (John Marriott) closes: vim/vim#16496 https://github.com/vim/vim/commit/efc41a5958bf25b352e0916af5f57dafbbb44f17 Omit os_expand_wildcards() change: Nvim's code is more complicated and harder to refactor. Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-01-15feat(messages): add :!cmd shell message kindsLuuk van Baal1
Also print stderr error messages with ErrorMsg highlight group.
2024-11-08refactor(message): propagate highlight id instead of attrsLuuk van Baal1
Problem: Highlight group id is not propagated to the end of the message call stack, where ext_messages are emitted. Solution: Refactor message functions to pass along highlight group id instead of attr id.
2024-10-03refactor: fix incorrect use of enum (#30631)zeertzjq1
2024-09-15refactor: rename "process" => "proc" #30387Justin M. Keyes1
Problem: - "process" is often used as a verb (`multiqueue_process_events`), which is ambiguous for cases where it's used as a topic. - The documented naming convention for processes is "proc". - `:help dev-name-common` - Shorter is better, when it doesn't harm readability or discoverability. Solution: Rename "process" => "proc" in all C symbols and module names.
2024-09-12refactor(stream.c): unused params in stream_close #30356Justin M. Keyes1
2024-06-11refactor(memory): use builtin strcat() instead of STRCAT()bfredl1
The latter was mostly relevant with the past char_u madness. NOTE: STRCAT also functioned as a counterfeit "NOLINT" for clint apparently. But NOLINT-ing every usecase is just the same as disabling the check entirely.
2024-06-09refactor(os/shell): we have DynamicBuffer at homebfredl1
DynamicBuffer at home: KVÄCK
2024-06-08refactor(io): make rstream use a linear bufferbfredl1
If you like it you shouldn't put a ring on it. This is what _every_ consumer of RStream used anyway, either by calling rbuffer_reset, or rbuffer_consumed_compact (same as rbuffer_reset without needing a scratch buffer), or by consuming everything in each stream_read_cb call directly.
2024-06-04fixup: apply the change on more filesJames Tirta Halim1
2024-06-01refactor: move shared messages to errors.h #26214Justin M. Keyes1
2024-05-31refactor(io): separate types for read and write streamsbfredl1
This is a structural refactor with no logical changes, yet. Done in preparation for simplifying rstream/rbuffer which will require more state inline in RStream. The initial idea was to have RStream and WStream as sub-types symetrically but that doesn't work, as sockets are both reading and writing. Also there is very little write-specific state to start with, so the benefit of a separate WStream struct is a lot smaller. Just document what fields in `Stream` are write specific.
2024-03-28docs: fix typos (#27868)dundargoc1
Co-authored-by: ite-usagi <77563904+ite-usagi@users.noreply.github.com> Co-authored-by: v-sim <56476039+v-sim@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Quico Augustijn <quico.public@gmail.com> Co-authored-by: nhld <nahnera@gmail.com> Co-authored-by: francisco souza <108725+fsouza@users.noreply.github.com>
2024-01-11refactor(IWYU): fix headersdundargoc1
Remove `export` pramgas from defs headers as it causes IWYU to believe that the definitions from the defs headers comes from main header, which is not what we really want.
2023-12-30refactor: follow style guidedundargoc1
2023-12-21refactor: run IWYU on entire repodundargoc1
Reference: https://github.com/neovim/neovim/issues/6371.
2023-12-20refactor: eliminate cyclic includesdundargoc1
2023-12-18docs: add style rule regarding initializationdundargoc1
Specifically, specify that each initialization should be done on a separate line.
2023-12-17refactor: move non-symbols to defs.h headersdundargoc1
2023-11-30build: don't define FUNC_ATTR_* as empty in headers (#26317)zeertzjq1
FUNC_ATTR_* should only be used in .c files with generated headers. Defining FUNC_ATTR_* as empty in headers causes misuses of them to be silently ignored. Instead don't define them by default, and only define them as empty after a .c file has included its generated header.
2023-11-29refactor: move some constants out of vim_defs.h (#26298)zeertzjq1
2023-11-29refactor(IWYU): create normal_defs.h (#26293)zeertzjq1
2023-11-28refactor: fix headers with IWYUdundargoc1
2023-11-27refactor: rename types.h to types_defs.hdundargoc1
2023-11-27build(IWYU): fix includes for undo_defs.hdundargoc1
2023-11-27build(IWYU): fix includes for func_attr.hdundargoc1
2023-11-13refactor: follow style guidedundargoc1
- reduce variable scope - prefer initialization over declaration and assignment - use bool to represent boolean values
2023-11-12build: remove PVSdundargoc1
We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable.
2023-11-05refactor: the long goodbyedundargoc1
long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types.
2023-10-23build(lint): remove unnecessary clint.py rulesdundargoc1
Uncrustify is the source of truth where possible. Remove any redundant checks from clint.py.
2023-09-30refactor: reorganize option header files (#25437)zeertzjq1
- Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other
2023-09-30build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq1