aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/fs.c
Commit message (Collapse)AuthorAge
* Merge #7863 'mingw64: fix gcc warnings'Justin M. Keyes2018-01-20
|\
| * Fix warning, read/write have unsigned int count on windows.George Zhao2018-01-19
| |
| * Fix warning about NULL compareGeorge Zhao2018-01-18
|/
* 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
* 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
* coverity/155509: negative close() argJustin M. Keyes2017-06-14
|
* 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
* 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.
* *: Add comment to all C filesZyX2017-04-19
|
* win: os_get_hostname() #5416 (#6413)Justin M. Keyes2017-04-07
|
* eval: Move remaining get_tv_string* functions to eval/typval.cZyX2017-03-29
|
* eval,*: Move get_tv_string to typval.cZyX2017-03-29
| | | | Function was renamed and changed to return `const char *`.
* os_set_cloexec: Fix condition. #5986Justin M. Keyes2017-03-17
| | | | Also: skip Test_undo_del_chars the right way. #6287
* job-control: set CLOEXEC on pty processes. #5986Matthew Malcomson2017-03-17
| | | | | Before this change, new processes started with libuv prevented SIGHUP from reaching pty processes (by keeping the ptmx file descriptor open).
* os/*: Use os_buf instead of NameBuff, IObuff.Justin M. Keyes2017-02-12
|
* refactor: fix warningsJustin M. Keyes2017-02-04
|
* win: executable(): full path without extensionJustin M. Keyes2017-02-04
| | | | Absolute path is considered executable even *without* an extension.
* win: Append process dir to $PATHJustin M. Keyes2017-02-04
| | | | | | | | This allows executables to be found by :!, system(), and executable() if they live next to ("sibling" to) nvim.exe. This is what gvim on Windows does, and also matches the behavior of Win32 SearchPath(). https://github.com/vim/vim/blob/c4a249a736d40ec54794827ef95804c225d0e38f/src/os_win32.c#L354-L370
* win: executable()Justin M. Keyes2017-02-04
| | | | | Windows: prepend `".;"` to PATH, as Vim does. https://github.com/vim/vim/blob/c4a249a736d40ec54794827ef95804c225d0e38f/src/os_win32.c#L1916
* win: fix warningsJustin M. Keyes2017-01-19
|
* Windows: vim_getenv(): Find runtime relative to nvim. #3303 (#5929)Justin M. Keyes2017-01-11
| | | | | | | | | | | | In Windows we cannot rely on absolute install paths to point to the location of the runtime. Vim uses the path of the current binary as a possible location for the runtime folder. In Neovim the install location places the runtime folder in ../share/nvim/runtime. In Vim this logic is guarded by USE_EXE_NAME, which is defined for win32 and macOS. TODO: We may need to incorporate similar logic for macOS: https://github.com/vim/vim/blob/0cdb72aa38c4a0140c94d56bf8bc17cb30260ebf/src/misc1.c#L4287-L4308
* os_nodetype: open fd with O_NONBLOCK (#5515)Justin M. Keyes2016-10-21
| | | | | Closes #5267 Helped-by: oni-link <knil.ino@gmail.com>
* refactor: eliminate misc2.cJustin M. Keyes2016-09-13
| | | | | | | | | | move `call_shell` to misc1.c Move some fns to state.c Move some fns to option.c Move some fns to memline.c Move `vim_chdir*` fns to file_search.c Move some fns to new module, bytes.c Move some fns to fileio.c
* Create os_translate_sys_error()Rui Abreu Ferreira2016-08-07
| | | | | | Wrap up uv_translate_sys_error and fallbacks into a new function os_translate_sys_error(). In windows a copy of the original uv_translate_sys_error() was imported from libuv.
* os_resolve_shortcut: Report conversion error.Justin M. Keyes2016-07-30
|
* mbyte.c: Move utf8/utf16 functions to mbyte.cJustin M. Keyes2016-07-30
|
* utf16_to_utf8Justin M. Keyes2016-07-30
|
* os_resolve_shortcut: cleanupJustin M. Keyes2016-07-30
|
* os_resolve_shortcut: Remove legacy win16 codepath.Justin M. Keyes2016-07-30
|
* utf8_to_utf16: adapt libuv's fs__capture_pathJustin M. Keyes2016-07-30
|
* os_resolve_shortcut: initial port from Vim sourceJustin M. Keyes2016-07-30
|
* Remove redundant includes of unistd.h (#5126)Rui Abreu Ferreira2016-07-29
|
* os/fs: Rename os_file_exists to os_path_exists (#4973)Daniel Xu2016-07-06
| | | | Because the old name did not indicate that the function would return true on directories as well.
* *: Satisfy linter (newest type casts rule)ZyX2016-06-24
|
* file: Add buffered reading and writingZyX2016-06-23
| | | | Still no busted tests. Not tested without HAVE_PREADV.
* file,os/fs,shada: Separate opening, closing, writing and reading filesZyX2016-06-23
| | | | | | | | Moves low-level functions handling to os/fs.c. Adds file.c with a proxy interface. Target: while leaving syscalls handling is os.c (partially handled by libuv), add buffering for reading and writing to file.c.
* Remove some unnecessary function attributes (#4909)oni-link2016-06-11
| | | | This removes attribute FUNC_ATTR_NONNULL_ALL for functions without a pointer parameter.
* os_nodetype: Return NODE_NORMAL if os_stat fails.Justin M. Keyes2016-05-22
| | | | | | | | Conforms to Vim's mch_nodetype. Regression by 7db4a15. buf_write() expects NODE_WRITABLE for character devices such as /dev/stderr. Closes #4772
* Windows: Fix os_nodetype() default returnRui Abreu Ferreira2016-05-06
|
* vim-patch:7.4.672KillTheMule2016-05-02
| | | | | | | | | | | Problem: When completing a shell command, directories in the current directory are not listed. Solution: When "." is not in $PATH also look in the current directory for directories. https://github.com/vim/vim/commit/b5971141dff0c69355fd64196fcc0d0d071d4c82 Most of it applied manually.
* *: Fix new linter errorsZyX2016-05-01
| | | | Originally there were 128 new errors, so I thought this is a good idea to fix all of them. Of course, this commit also fixes many suppressed errors.
* Add missing include fcntl.hRui Abreu Ferreira2016-04-29
| | | | In Windows, open() flags like O_RDONLY need fcntl.h.
* os_nodetype: impl with libuvJustin M. Keyes2016-04-29
|
* vim-patch:7.4.1114Jurica Bradaric2016-04-20
| | | | | | | Problem: delete() does not work well with symbolic links. Solution: Recognize symbolik links. https://github.com/vim/vim/commit/43a34f9f74fdce462fa250baab620264c28b6165
* path.c: enable -WconversionCharles Joachim2016-03-27
|
* Windows: use $PATHEXT to find executables in path.Rui Abreu Ferreira2016-01-30
| | | | | | | | | | | is_executable_in_path() searches for executables in $PATH, but on Windows executable files have extensions available in the environment var $PATHEXT. This commit changes is_executable_in_path() to append those extensions to the filename. This patch diverges from standard Vim, in that Vim only checked for the given filename if it already has an extensions. This one always checks for the given filename.
* Windows: use ';' as env $PATH separator.Rui Abreu Ferreira2016-01-11
| | | | | | In Windows the separator character in the PATH environment is ';' instead of ':'. Add a new define ENV_SEPCHAR to be used instead of hardcoding the character literal.