aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/env.c
Commit message (Collapse)AuthorAge
* refactor: fix clint warnings (#17682)dundargoc2022-03-13
|
* vim-patch:8.2.0942: expanding to local dir after homedir keeps "~/"zeertzjq2022-02-07
| | | | | | | Problem: Expanding to local dir after homedir keeps "~/". Solution: Adjust modify_fname(). (Christian Brabandt, closes vim/vim#6205, closes vim/vim#5979) https://github.com/vim/vim/commit/0e390f40e944036fb558a63b91238cfda128d95f
* refactor: reduce number of explicit char casts (#16077)dundargoc2021-11-16
| | | * refactor: reduce number of explicit char casts
* vim-patch:8.1.0743: giving error messages is not flexibleJames McCoy2021-11-01
| | | | | | | | | Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
* Refactor/uncrustify (#15790)dundargoc2021-09-29
| | | | | | | | | | | | | * refactor: format with uncrustify * fixup(dundar): fix functions comments * fixup(dundar): remove space between variable and ++/-- * fixup(dundar): better workaround for macro attributes This is done to be able to better use uncrustify rules for macros * fixup(justin): make preprocessors follow neovim style guide
* refactor: reformat with uncrustify #15736dundargoc2021-09-20
| | | | * fix function parameter comments * remove space after star in function names
* refactor: format files with uncrustify #15663dundargoc2021-09-14
|
* refactor(map): remove extra-allocating map_new/map_free functionsBjörn Linse2021-08-22
| | | | | | | | | | Note: the reason for removing them is not that there after this refactor is no use of them, but rather that having them available is an anti-pattern: they manange an _extra_ heap allocation which has nothing to do with the functionality of the map itself (khash manages the real buffers internally). In case there happens to be a reason to allocate the map structure itself later, this should be made explicit using xcalloc/xfree calls.
* Use uv_os_homedir and current directory as backup when $HOME is not set (#13657)ffanzhang2021-01-10
| | | | | | Close https://github.com/neovim/neovim/issues/8614 Use uv_os_homedir and current directory as backup if HOME env is not set. Allocate homedir only if var is not NULL.
* win: avoid duplicate separators in $PATH #12869Justin M. Keyes2020-09-08
| | | | | | | | | | | | | | | Seems like redundant env var separators (";" on Windows) in $PATH can cause weird behavior. From #7377: > After some time, system(['win32yank', '-o']) and system('win32yank -o') > start returning different results: specifically first returns an > empty string. > > 1. $PATH weirdly contains double semicolon followed by path to the > “installation directory” (unpacked directory from archive). > 2. If I run `let $PATH=substitute($PATH, ';;', ';', 'g')` the problem is fixed. close #7377 ref 224f99b85d311ebd31451db13b66e4a3c7e51938
* env: try find library dir (like /usr[/local]/lib/nvim) and add it to &rtpBjörn Linse2020-02-07
|
* os/env: fix pvs/v781Jan Edmund Lazo2019-12-26
|
* os_getenvname_at_index: Handle Windows env vars whose name starts with =James McCoy2019-12-11
|
* Add os_getfullenv_size/os_copyfullenvJames McCoy2019-12-11
|
* jobstart now supports env/clear_envMatthieu Coudron2019-12-11
| | | | to modify the environment of the launched job.
* TUI/thread: guard env map from potential race with unibilium #11259erw72019-10-20
| | | unibi_from_term calls getenv internally, so exclusive control is required.
* Fix potential deadlock #11151erw72019-10-04
| | | | | ELOG may call os_getenv and os_setenv internally. In that case, a deadlock occurs.
* Revert "win/os_env_exists(): workaround libuv bug #10734"Daniel Hahler2019-09-25
| | | | This reverts commit 278c5d452c2cbc436a9cc317407ae6021a226c3a.
* env: use putenv_s for LC_ALL, LANG, etc. #11050erw72019-09-22
| | | | | | | | Problem: ":lang messages en_US.UTF-8" no longer overrides the language detected from the environment (at startup). Solution: In os_setenv, special-case "LC_ALL", "LANG", et al. to use putenv_s instead of uv_os_setenv. fixes #11045
* vim-patch:8.1.1897: may free memory twice when out of memory (#10827)Jan Edmund Lazo2019-08-22
| | | | | | Problem: May free memory twice when out of memory. Solution: Check that backslash_halve_save() returns a different pointer. (Dominique Pelle, closes vim/vim#4847) https://github.com/vim/vim/commit/f1552d07d715b437d941659479942c2543b02bd4
* utf16_to_utf8: align with libuvJustin M. Keyes2019-08-15
| | | | | | | | | - take a size parameter - return libuv error code - handle error in caller only (avoid redundant messages) https://github.com/libuv/libuv/commit/53995a3825d23eacd01e2bcfa35642c4a188d32b https://github.com/libuv/libuv/commit/4c945f49365ab4d6e1b07bf0ef2893455dc04622
* Merge #10098 'win: fix msg_puts_printf()'Justin M. Keyes2019-08-12
|\
| * Fix problems with message catalog directoryerw72019-06-09
| | | | | | | | | | | | | | | | - In appimage, the message catalog is not used because there is no message catalog in LOCALE_INSTALL_DIR. Therefore, change to exepath/../share/locale instead of LOCALE_INSTALL_DIR. - The old vim style($runtime/lang) is no longer used. Thus all relevant code is removed.
* | win/env: Vim-compat: Empty string deletes env var #10743erw72019-08-11
| | | | | | | | | | | | | | | | - Windows: `set FOO=` deletes environment variable FOO, and there is no way to set empty string expect by calling the API. - Vim-compatible: `:let $FOO=""` deletes the environment variable. - See also Test_WindowsHome(). ref: https://github.com/neovim/neovim/pull/10657#issuecomment-516368089
* | win: expand nested env var #10662erw72019-08-11
| | | | | | | | Vim-compatible behavior for a Windows edge case.
* | win/os_env_exists(): workaround libuv bug #10734Justin M. Keyes2019-08-10
| | | | | | | | | | | | | | | | | | | | os_env_exists() fails on MSVC build: os_env_exists:104: uv_os_getenv(EMPTY_VAR) failed: -4094 UNKNOWN - Revert 396a3945c4eba733b3a99a7ded217af83a400791 - HACK: Windows: return TRUE if uv_os_getenv() returns UV_UNKNOWN, until libuv bug is fixed: https://github.com/libuv/libuv/issues/2413 ref https://github.com/neovim/neovim/commit/396a3945c4eba733b3a99a7ded217af83a400791#r34642361
* | f_environ: cleanup/refactorDaniel Hahler2019-08-06
| | | | | | | | | | - use os_getenvname_at_index / os_getenv - f_getenv: empty (*p == NUL) is not null (undefined)
* | env: invalid pointer after os_setenv() #10558erw72019-07-23
|/
* vim-patch:8.1.0211: expanding a file name "~" results in $HOMEJan Edmund Lazo2019-05-25
| | | | | | Problem: Expanding a file name "~" results in $HOME. (Aidan Shafran) Solution: Change "~" to "./~" before expanding. (closes vim/vim#3072) https://github.com/vim/vim/commit/00136dc321586800986e8f743c2f108f5eecbf92
* Merge #9686 'win/Lua: monkey-patch os.getenv()'Justin M. Keyes2019-03-16
|\ | | | | | | fixes #9681
| * Fix environment variable on Windowserw72019-03-06
|/ | | | | | | Since uv_os_setenv uses SetEnvironmentVariableW, _wenviron is no updated. As a result, inconsistency occurs in completion of environment variable names. Change to use GetEnvironmentStaringsW instead of _wenviron to solve it.
* os/env: Fix completion of multibyte env var nameserw72019-03-03
| | | | fixes #9655
* os/env: use libuv v1.12 getenv/setenv APIJustin M. Keyes2019-02-27
| | | | | | | | | | | - Minimum required libuv is now v1.12 - Because `uv_os_getenv` requires allocating, we must manage a map (`envmap` in `env.c`) to maintain the old behavior of `os_getenv` . - free() map-items after removal. khash.h does not make copies of anything, so even its keys must be memory-managed by the caller. closes #8398 closes #9267
* os_getenv, os_setenv: revert "widechar" implJustin M. Keyes2019-02-26
| | | | | | | | | | It's reported that the Windows widechar variants do automatically convert from the current codepage to UTF16, which is very helpful. So the "widechar" impls are a good direction. But libuv v1.12 does that for us, so the next commit will use that instead. ref #8398 ref #9267
* win: os_getenv(): use _wgetenv()Justin M. Keyes2019-02-25
|
* os_setenv: use _wputenv_s; remove vestigial code #7920Justin M. Keyes2019-02-25
| | | | | _putenv_s variant was left over from 810d31a43001, should have been removed in cd5b1315757e.
* Merge #9401 from justinmk/pr-win-erw7Justin M. Keyes2018-12-30
|\
| * cleanup: Remove os_term_is_nice()Justin M. Keyes2018-12-30
| |
* | vim-patch:8.1.0662: needlessly searching for tilde in stringJames McCoy2018-12-30
|/ | | | | | Problem: Needlessly searching for tilde in string. Solution: Only check the first character. (James McCoy, closes vim/vim#3734) https://github.com/vim/vim/commit/ef0a1d5ed3566b91143d30ae9de3240f47c6e282
* vim-patch:8.0.0883: invalid memory access with nonsensical scriptJan Edmund Lazo2018-08-24
| | | | | | Problem: Invalid memory access with nonsensical script. Solution: Check "dstlen" being positive. (Dominique Pelle) https://github.com/vim/vim/commit/1c864093f93b0066de25d6c0ddf03a6bc6b1c870
* vim-patch:8.0.1012: MS-Windows: problem with $HOME when is was set internallyJan Edmund Lazo2018-07-24
| | | | | | | | | Problem: MS-Windows: Problem with $HOME when is was set internally. Solution: Only use the $HOME default internally. (Yasuhiro Matsumoto, closes vim/vim#2013) https://github.com/vim/vim/commit/48340b62e812dc9280f621a2eb6db76d43555c66 Restore vim_getenv() behaviour for $HOME on Windows.
* use wchar_t instead of WCHAR #6998Matt Kline2018-06-18
| | | | wchar_t has better cross-platform support and seems to fix an issue on MinGW when building with `-std=c99`.
* expand_env_esc: fix invalid memory access (#8508)Justin M. Keyes2018-06-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ref be68f218ffef [OLDTEST] Running test_options Failed: F /tests/oldtests|test_options :: Nvim exited with non-zero code -en travis_fold:start:-tests-oldtests-test-options ================================================================= ==26191==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000067900 at pc 0x0000004768bd bp 0x7ffe6bd02de0 sp 0x7ffe6bd02580 READ of size 4096 at 0x621000067900 thread T0 0 0x4768bc in __interceptor_getpwnam /local/mnt/workspace/tmp/ubuntu_rel/llvm/utils/release/final/llvm.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:1726:3 1 0x12847c5 in os_get_user_directory /home/travis/build/neovim/neovim/build/../src/nvim/os/users.c:82:8 2 0x125a3e3 in expand_env_esc /home/travis/build/neovim/neovim/build/../src/nvim/os/env.c:380:25 3 0x1257fdb in expand_env_save_opt /home/travis/build/neovim/neovim/build/../src/nvim/os/env.c:255:3 4 0x1291b77 in gen_expand_wildcards /home/travis/build/neovim/neovim/build/../src/nvim/path.c:1195:13 5 0x129e2e7 in expand_wildcards /home/travis/build/neovim/neovim/build/../src/nvim/path.c:2018:12 6 0x129e193 in expand_wildcards_eval /home/travis/build/neovim/neovim/build/../src/nvim/path.c:1986:11 7 0xc2ddc3 in ExpandFromContext /home/travis/build/neovim/neovim/build/../src/nvim/ex_getln.c:4685:11 8 0xc29412 in ExpandOne /home/travis/build/neovim/neovim/build/../src/nvim/ex_getln.c:3775:9 9 0x931364 in f_expand /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:8257:32 10 0x811954 in call_func /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6373:11 11 0x8256b8 in get_func_tv /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6119:11 12 0x8ad6a1 in eval7 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:4217:15 13 0x8a9c6b in eval6 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3914:7 14 0x8a797f in eval5 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3765:7 15 0x8a319f in eval4 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3502:7 16 0x8a263c in eval3 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3420:7 17 0x8a1adc in eval2 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3351:7 18 0x809b21 in eval1 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3278:7 19 0x824f24 in get_func_tv /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6092:9 20 0x81e674 in ex_call /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:2726:9 21 0xb4db73 in do_one_cmd /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:2238:5 22 0xb30119 in do_cmdline /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:602:20 23 0x845232 in call_user_func /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:21396:3 24 0x81127b in call_func /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6358:11 25 0x8256b8 in get_func_tv /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6119:11 26 0x81e674 in ex_call /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:2726:9 27 0xb4db73 in do_one_cmd /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:2238:5 28 0xb30119 in do_cmdline /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:602:20 29 0x8645f1 in ex_execute /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:19541:7 30 0xb4db73 in do_one_cmd /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:2238:5 31 0xb30119 in do_cmdline /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:602:20 32 0x845232 in call_user_func /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:21396:3 33 0x81127b in call_func /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6358:11 34 0x8256b8 in get_func_tv /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6119:11 35 0x81e674 in ex_call /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:2726:9 36 0xb4db73 in do_one_cmd /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:2238:5 37 0xb30119 in do_cmdline /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:602:20 38 0xb19f2d in do_source /home/travis/build/neovim/neovim/build/../src/nvim/ex_cmds2.c:2973:3 39 0xb16580 in cmd_source /home/travis/build/neovim/neovim/build/../src/nvim/ex_cmds2.c:2718:14 40 0xb16677 in ex_source /home/travis/build/neovim/neovim/build/../src/nvim/ex_cmds2.c:2699:3 41 0xb4db73 in do_one_cmd /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:2238:5 42 0xb30119 in do_cmdline /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:602:20 43 0xb362c5 in do_cmdline_cmd /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:278:10 44 0xe8e3a3 in exe_commands /home/travis/build/neovim/neovim/build/../src/nvim/main.c:1705:5 45 0xe7bbba in main /home/travis/build/neovim/neovim/build/../src/nvim/main.c:518:5 46 0x2b0e17bd1f44 in __libc_start_main /build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:287 47 0x44dcfb in _start (/home/travis/build/neovim/neovim/build/bin/nvim+0x44dcfb) 0x621000067900 is located 0 bytes to the right of 4096-byte region [0x621000066900,0x621000067900) allocated by thread T0 here: 0 0x4eeed3 in malloc /local/mnt/workspace/tmp/ubuntu_rel/llvm/utils/release/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:67:3 1 0xf87981 in try_malloc /home/travis/build/neovim/neovim/build/../src/nvim/memory.c:87:15 2 0xf87ba9 in xmalloc /home/travis/build/neovim/neovim/build/../src/nvim/memory.c:121:15 3 0x1257f6f in expand_env_save_opt /home/travis/build/neovim/neovim/build/../src/nvim/os/env.c:254:15 4 0x1291b77 in gen_expand_wildcards /home/travis/build/neovim/neovim/build/../src/nvim/path.c:1195:13 5 0x129e2e7 in expand_wildcards /home/travis/build/neovim/neovim/build/../src/nvim/path.c:2018:12 6 0x129e193 in expand_wildcards_eval /home/travis/build/neovim/neovim/build/../src/nvim/path.c:1986:11 7 0xc2ddc3 in ExpandFromContext /home/travis/build/neovim/neovim/build/../src/nvim/ex_getln.c:4685:11 8 0xc29412 in ExpandOne /home/travis/build/neovim/neovim/build/../src/nvim/ex_getln.c:3775:9 9 0x931364 in f_expand /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:8257:32 10 0x811954 in call_func /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6373:11 11 0x8256b8 in get_func_tv /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6119:11 12 0x8ad6a1 in eval7 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:4217:15 13 0x8a9c6b in eval6 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3914:7 14 0x8a797f in eval5 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3765:7 15 0x8a319f in eval4 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3502:7 16 0x8a263c in eval3 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3420:7 17 0x8a1adc in eval2 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3351:7 18 0x809b21 in eval1 /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:3278:7 19 0x824f24 in get_func_tv /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6092:9 20 0x81e674 in ex_call /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:2726:9 21 0xb4db73 in do_one_cmd /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:2238:5 22 0xb30119 in do_cmdline /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:602:20 23 0x845232 in call_user_func /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:21396:3 24 0x81127b in call_func /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6358:11 25 0x8256b8 in get_func_tv /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:6119:11 26 0x81e674 in ex_call /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:2726:9 27 0xb4db73 in do_one_cmd /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:2238:5 28 0xb30119 in do_cmdline /home/travis/build/neovim/neovim/build/../src/nvim/ex_docmd.c:602:20 29 0x8645f1 in ex_execute /home/travis/build/neovim/neovim/build/../src/nvim/eval.c:19541:7 SUMMARY: AddressSanitizer: heap-buffer-overflow /local/mnt/workspace/tmp/ubuntu_rel/llvm/utils/release/final/llvm.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:1726:3 in __interceptor_getpwnam Shadow bytes around the buggy address: 0x0c4280004ed0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c4280004ee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c4280004ef0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c4280004f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c4280004f10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c4280004f20:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4280004f30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4280004f40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4280004f50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4280004f60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c4280004f70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==26191==ABORTING Failed: E /tests/oldtests|logs :: Runtime errors detected. Job exited with code 1 Screen (23 lines)
* *: Fix clint errorsZyX2018-04-22
|
* os/env: Refactor home_replace() to the new style and to return lengthZyX2018-04-09
|
* refactor/rename: path_is_absolute()Justin M. Keyes2018-03-24
|
* vim-patch:8.0.0074Michael Schupikov2017-12-15
| | | | | | | | | | Problem: Cannot make Vim fail on an internal error. Solution: Add IEMSG() and IEMSG2(). (Domenique Pelle) Avoid reporting an internal error without mentioning where. https://github.com/vim/vim/commit/95f096030ed1a8afea028f2ea295d6f6a70f466f Signed-off-by: Michael Schupikov <michael@schupikov.de>
* vim_getenv: Remove redundant NULL check.Justin M. Keyes2017-05-20
|
* startup: init v:progpath before calling vim_getenv (#6755)Justin M. Keyes2017-05-17
|
* env_iter: Learn `delim` parameter.Justin M. Keyes2017-05-15
|