aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/fs.c
Commit message (Collapse)AuthorAge
...
* | is_extension_executable: simplifyerw72019-04-01
| | | | | | | | Simplify method of determining search position of the extension.
* | cleanup: PATHEXT functionerw72019-04-01
| |
* | test/win: executable(), exepath() #9516erw72019-04-01
| |
* | win: exepath(): append extension if omittederw72019-04-01
| | | | | | | | fixes #9403
* | win: executable(): also check extensionerw72019-04-01
| |
* | win: executable(): fix relative path bugerw72019-04-01
|/ | | | | Qualified (i.e. dot-prefixed) relative paths should only search CWD, not $PATH.
* executable(): return false if user is not owner #9703erw72019-03-09
| | | | | | | | | | S_IXUSR does not check ownership. Test case: touch test.txt chmod 744 test.txt sudo chown root:root test.txt nvim -u NORC :echo executable('./test.txt')
* os/env: Fix completion of multibyte env var nameserw72019-03-03
| | | | fixes #9655
* os: remove uv_translate_sys_error impl #9652Justin M. Keyes2019-03-01
| | | Since libuv minimum version is now v1.12, we can use libuv's impl.
* deps: update to libuv v1.26.0Justin M. Keyes2019-02-21
| | | | | | | | | | | | | | | | | | | | | | | Notable changes since v1.23.2: - v1.26.0 - uv_os_uname() - unix: don't attempt to invalidate invalid fd https://github.com/libuv/libuv/commit/1ce6393a5780538ad8601cae00c5bd079b9415a9 - v1.25.0 - unix: better handling of unsupported F_FULLFSYNC (fixes #6725) https://github.com/libuv/libuv/commit/6fc797c3fe18d8df71b36ecf2184f085c0283251 - tty,win: fix Alt+key under WSL https://github.com/libuv/libuv/commit/d2e59bb6003d707bdebd7a381f5a7e1d0cc3fd3b - fsevents: really watch files with fsevents on macos 10.7+ https://github.com/libuv/libuv/commit/2d2af382ce84b91d6ee7a185af32fca7f0acd84b - win: fix duplicate tty vt100 fn key - v1.24.0 - win,fs: retry if uv_fs_rename fails https://github.com/libuv/libuv/commit/e94c184c7c4a18f3de569c97caeb83f4ff98a4b2 - later [reverted](https://github.com/libuv/libuv/issues/2098) but may be useful reference - win: support more fine-grained windows hiding https://github.com/libuv/libuv/commit/4c2dcca27b80945d6b7063f0ea031b8a75a46a52
* fix "E667: Fsync failed" on macOSJustin M. Keyes2019-02-21
| | | | | | | | | | | | | macOS: Try direct fsync() if F_FULLFSYNC fails. closes #6725 ref https://github.com/vim/vim/pull/4016 vim-patch:8.1.0957 > on macOS F_FULLFSYNC fails with ENOTSUP for unsupported storage systems > (e.g. SMB), though this is not documented in the Apple fcntl man page. libuv fixed this in v1.25.0: https://github.com/libuv/libuv/commit/6fc797c3fe18d8df71b36ecf2184f085c0283251
* jobstart(): Fix hang on non-executable cwd #9204Tommy Allen2018-11-07
| | | | | | | * os/fs.c: add os_isdir_executable() * eval.c: fix hang on job start caused by non-executable cwd option * channel.c: assert cwd is an executable directory * test: jobstart() produces error when using non-executable cwd
* 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`.
* Merge #8218 'Fix errors reported by PVS'Justin M. Keyes2018-04-27
|\ | | | | closes #4983
| * os/fs: Fix PVS/V560: condition was already checked in while()ZyX2018-04-15
| | | | | | | | It is not possible to enter while loop body with unsigned2 == 0 if loop condition requires unsigned1 < unsigned2.
* | API: nvim__stats()Justin M. Keyes2018-04-24
| | | | | | | | Use it to verify fsync() behavior.
* | Merge branch 'master' into s-dash-stdinb-r-o-c-k2018-04-14
|\|
| * refactor/rename: path_is_absolute()Justin M. Keyes2018-03-24
| |
| * 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
| |/
* | Merge branch 'master' into s-dash-stdinZyX2017-12-03
|\|
| * 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 *`.
* | fileio,main: Do not restart syscall at EAGAIN when reading for -sZyX2017-03-19
| |
* | main: Temporary fix assertion errorZyX2017-03-19
|/ | | | | This variant uses `fdopen()` which is not standard, but it fixes problem on my system. In next commit `scriptin` will use `FileDescriptor*` from os/fileio in place of `FILE*`.
* 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
|