aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
Commit message (Collapse)AuthorAge
...
* | | channels: refactorBjörn Linse2017-11-24
| | |
* | | os_nodetype: reworkJustin M. Keyes2017-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the Windows impl closer to Vim os_win32.c, and the Unix impl closer to Vim os_unix.c. Outcomes: - Do not send negative fd to close(). ref #4806 #4772 #6860 - Fallback return-value is now correct in (hopefully) all cases. - unix: check S_ISXXX instead of relying on os_open (which can fail for irrelevant reasons). buf_write() expects NODE_WRITABLE for character devices such as /dev/stderr. 96f834a8424e
* | | os_open, os_stat: UV_EINVAL on NULL filenameJustin M. Keyes2017-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EINVAL (instead of EFAULT) because that's what glibc does: https://github.com/bminor/glibc/blob/master/io/open.c#L35 os_nodetype: check for UV_EINVAL explicitly. ref #4370 ref https://github.com/neovim/neovim/issues/4370#issuecomment-344366571 ref ac055d677aa9eff9fca11cecb5ac7f7a4edb0265 ref #4772
* | | pty_process_win: avoid quoting for cmd.exeerw72017-08-16
| | |
* | | win/pty: log errorserw72017-08-16
| | |
* | | win/pyt: cleanuperw72017-08-16
| | |
* | | win/pty: quote_cmd_arg(): check boundserw72017-08-16
| | |
* | | win/pty: jobstart, jobstop: fix null-pointer dereferenceerw72017-08-16
| | | | | | | | | | | | | | | | | | | | | - Make sure that proc->in is not NULL, because nvim crashed when starting a job with pty. - Make sure that proc->out is not NULL, because nvim crashed when stopping a job opened with pty.
* | | win: support :terminalerw72017-08-16
| | |
* | | win: integrate winpty (WIP)Ryan Prichard2017-08-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling of process exit is still broken. It detects the moment when the child process exits, then quickly stops polling for process output. It should continue polling for output until the agent has scraped all of the process' output. This problem is easy to notice by running a command like "dir && exit", but even typing "exit<ENTER>" can manifest the problem -- the "t" might not appear. winpty's Cygwin adapter handles shutdown by waiting for the agent to close the CONOUT pipe, which it does after it has scraped the child's last output. AFAIK, neovim doesn't do anything interesting when winpty closes the CONOUT pipe.
* | | io: more guards against NULL filename (#7159)Justin M. Keyes2017-08-13
| | | | | | | | | | | | References ac055d677aa9 References #4370
* | | os_stat: return ENOENT on NULL filename argJames McCoy2017-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #4370 Explication: In the backtrace in #4370, we see that `buf_write()` was called with non-NULL `fname` and `sfname` arguments, but they've since _become_ NULL. #7 0x00000000004de09d in buf_write (buf=0x1dee040, fname=0x0, fname@entry=0x1e985b0 "/home/sean/src/github.com/snczl/virta/pkg/meld/segment.go", sfname=0x0, sfname@entry=0x1ddfa60 "segment.go", start=1, end=72, eap=eap@entry=0x7ffc6b032e60, append=0, forceit=0, reset_changed=1, filtering=0) at /home/travis/build/neovim/bot-ci/build/neovim/src/nvim/fileio.c:2576 This is most likely due to the code that restores those values from `buf`, which happens just before the fatal call to `os_fileinfo` ```c /* * The autocommands may have changed the name of the buffer, which may * be kept in fname, ffname and sfname. */ if (buf_ffname) ffname = buf->b_ffname; if (buf_sfname) sfname = buf->b_sfname; if (buf_fname_f) fname = buf->b_ffname; if (buf_fname_s) fname = buf->b_sfname; ``` It's worth noting that at this point `ffname` is still non-NULL, so it _could_ be used. However, our current code is purely more strict than Vim in this area, which has caused us problems before (e.g., `getdigits()`). The commentary for `struct file_buffer` clearly indicate that all of `b_ffname`, `b_sfname`, and `b_fname` may be NULL: ```c /* * b_ffname has the full path of the file (NULL for no name). * b_sfname is the name as the user typed it (or NULL). * b_fname is the same as b_sfname, unless ":cd" has been done, * then it is the same as b_ffname (NULL for no name). */ char_u *b_ffname; /* full path file name */ char_u *b_sfname; /* short file name */ char_u *b_fname; /* current file name */ ``` Vim directly calls `stat(2)` which, although it is annotated to tell the compiler that the path argument is non-NULL, does handle a NULL pointer by returning a `-1` value and setting `errno` to `EFAULT`. This satisfies Vim's check, since it treats any `-1` return from `stat(2)` to mean the file doesn't exist (at least in this code path). Note that Vim's mch_stat() implementations on win32 and solaris clearly cannot accept NULL `name`. But the codepaths that call mch_stat will NULL `name` tend to be unix-only (eg: u_read_undo)!
* | | buf_write(): wrong argument to os_fileinfo_hardlinksJustin M. Keyes2017-08-09
| | | | | | | | | | | | | | | | | | | | | This was broken in ye olde refactor from 2014: e85fe0957d40080f43cbfcbe9eb8864475325b09 References #4370
* | | win_defs.h: redefine RGB macro after undefiningJustin M. Keyes2017-08-06
| | | | | | | | | | | | | | | | | | | | | Before this change, if os_defs.h was included after macros.h then win_defs.h would undefine our own RGB macro. vim-patch:8.0.0146
* | | coverity/155506: null dereference (#7089)Justin M. Keyes2017-07-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity warning is a false positive: if rbuffer_read_ptr() returns NULL then `cnt` is zero. Revert 76ea97c809e50fccc5ca6615943ac6da1db1e030 (which caused the TSan build to hang often--possibly because of the missing ui_flush()). Instead, modify out_data_append_to_screen() to check for NULL. ref #6862
* | | main: Flush file in place of closing it, also do error reportingZyX2017-07-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently on travis OS X systems it crashes when cleaning up streams with stdout closed: (lldb) bt all * thread #1: tid = 0x0000, 0x00007fff8703df06 libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGSTOP * frame #0: 0x00007fff8703df06 libsystem_kernel.dylib`__pthread_kill + 10 frame #1: 0x00007fff93a764ec libsystem_pthread.dylib`pthread_kill + 90 frame #2: 0x00007fff97c056df libsystem_c.dylib`abort + 129 frame #3: 0x00007fff97bccdd8 libsystem_c.dylib`__assert_rtn + 321 frame #4: 0x0000000107a4e106 nvim`uv__close(fd=<unavailable>) + 102 at core.c:521 frame #5: 0x0000000107a5307d nvim`uv__loop_close(loop=0x00007fff5847c018) + 77 at loop.c:118 frame #6: 0x0000000107a4d149 nvim`uv_loop_close(loop=0x00007fff5847c018) + 57 at uv-common.c:626 frame #7: 0x000000010783e5bc nvim`stream_set_blocking(fd=0, blocking=true) + 204 at stream.c:34 frame #8: 0x000000010795d66b nvim`mch_exit(r=0) + 91 at os_unix.c:147 frame #9: 0x00000001078d5663 nvim`command_line_scan(parmp=0x00007fff5847c760) + 1779 at main.c:787 frame #10: 0x00000001078d4393 nvim`main(argc=2, argv=0x00007fff5847c898) + 163 at main.c:249 frame #11: 0x00007fff8cdd65ad libdyld.dylib`start + 1 frame #12: 0x00007fff8cdd65ad libdyld.dylib`start + 1
* | | os: Add OS_STD*_FILENO constantsZyX2017-07-04
| | |
* | | os/fileio: Add ability to use os/fileio.c for file descriptorsZyX2017-07-04
| | | | | | | | | | | | Code imported from #6299
* | | os/fileio: Add msgpack_file_write functionZyX2017-07-04
| | |
* | | coverity/155506: fixing "dereference null after check" (#6862)Chris Hall2017-06-19
| | | | | | | | | | | | | | | | | | | | | rbuffer_read_ptr may return a null if ptr == null && cnt == 0 && !out_data_decide_throttle(cnt) then we would have called out_data_append_to_screen(ptr, cnt, eof) which dereferences the null pointer.
* | | coverity/155509: negative close() argJustin M. Keyes2017-06-14
| | |
* | | log: Always enable; remove DISABLE_LOGJustin M. Keyes2017-06-07
| | | | | | | | | | | | | | | | | | - Establish ERROR log level as "critical". Such errors are rare and will be valuable when users encounter unusual circumstances. - Set -DMIN_LOG_LEVEL=3 for release-type builds
* | | pty_process_unix.c: include <libutil.h> on DragonFly BSDJustin M. Keyes2017-05-21
| | | | | | | | | | | | | | | | | | | | | From FreeBSD ports patch: https://svnweb.freebsd.org/ports/head/editors/neovim/files/patch-src_nvim_os_pty__process__unix.c?revision=425833&view=markup References https://github.com/neovim/neovim/issues/6771#issuecomment-302921368
* | | 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
| | |
* | | vim_getenv: Use v:progpath instead of os_exepath.Justin M. Keyes2017-05-15
| | |
* | | startup: v:progpath fallback: path_guess_exepathJustin M. Keyes2017-05-15
| | | | | | | | | | | | | | | | | | | | | If procfs is missing then libuv cannot find the exe path. Fallback to path_guess_exepath(), adapted from Vim findYourself(). Closes #6734
* | | os/shell.c: temporary solution to not put ctrl chars on the screen gridBjörn Linse2017-05-10
| | |
* | | refactor/single-include (#6687)Carlo Abelli2017-05-08
| | |
* | | api/nvim_get_mode: Use child-queue instead of "priority".Justin M. Keyes2017-04-28
| | |
* | | input.c: Process only safe events before blocking.Justin M. Keyes2017-04-28
| | | | | | | | | | | | | | | Introduce multiqueue_process_priority() to process only events at or above a certain priority.
* | | api: nvim_get_mode()Justin M. Keyes2017-04-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Asynchronous API functions are served immediately, which means pending input could change the state of Nvim shortly after an async API function result is returned. nvim_get_mode() is different: - If RPCs are known to be blocked, it responds immediately (without flushing the input/event queue) - else it is handled just-in-time before waiting for input, after pending input was processed. This makes the result more reliable (but not perfect). Internally this is handled as a special case, but _semantically_ nothing has changed: API users never know when input flushes, so this internal special-case doesn't violate that. As far as API users are concerned, nvim_get_mode() is just another asynchronous API function. In all cases nvim_get_mode() never blocks for more than the time it takes to flush the input/event queue (~µs). Note: This doesn't address #6166; nvim_get_mode() will provoke #6166 if e.g. `d` is operator-pending. Closes #6159
* | | test/fs: sanity check for literal "~" directory (#6579)Justin M. Keyes2017-04-24
| | | | | | | | | | | | If the CWD contains a directory with the literal name "~" then the tests will have bogus failures.
* | | os_term_is_nice: Return true for rxvt and iTerm.Justin M. Keyes2017-04-22
| | |
* | | Merge #6550 from ZyX-I/pvs-check-commentJustin M. Keyes2017-04-20
|\ \ \
| * | | *: Add comment to all C filesZyX2017-04-19
| | | |
* | | | vim-patch:7.4.2209James McCoy2017-04-19
|/ / / | | | | | | | | | | | | | | | | | | | | | Problem: Cannot map <M-">. (Stephen Riehm) Solution: Solve the memory access problem in another way. (Dominique Pelle) Allow for using <M-\"> in a string. https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
* | | os/env: Fix “invalid pointer to local” false positiveZyX2017-04-16
| | |
* | | fileio: Silence “!= identical subexpressions” warningZyX2017-04-16
| | |
* | | os/shell: Remove FUNC_ATTR_MALLOC from shell_build_argvZyX2017-04-15
| | | | | | | | | Returns an array of allocated strings.
* | | os/fileio: Remove FUNC_ATTR_MALLOC for file_open_newZyX2017-04-15
| | | | | | | | | fp contains pointer to rbuffer
* | | win: os_shell_is_cmdexe() + testsJustin M. Keyes2017-04-12
| | |
* | | win: defaults: 'shellredir', 'shellxquote', 'shellxescape'Justin M. Keyes2017-04-12
| |/ |/|
* | win: os_get_hostname() #5416 (#6413)Justin M. Keyes2017-04-07
| |
* | 'guicursor': Disable by default for unknown terminals.Justin M. Keyes2017-04-04
| | | | | | | | | | | | | | User can still set guicursor explicitly in init.vim. Closes #5990 Closes #6403
* | fileio: Refactor msg_add_fname to something which needs no commentsZyX2017-04-03
| |
* | eval: Make writefile() able to disable fsync()ZyX2017-04-02
| |
* | eval,fileio: Omit additional fsync() callZyX2017-04-01
| | | | | | | | Fixes #6420
* | Merge pull request #6397 from jamessan/coverityJames McCoy2017-03-31
|\ \ | | | | | | Fix latest Coverity issues