Most internal functions to modify buffers operate on the current buffer and
require temporary switchs. This macro is a temporary workaround until a cleaner
refactoring of the internal API is performed.
Add missing parentheses and whatnot, move dangling comment, etc. Some
specific items worth mentioning:
Fixed some references to non-existent tags, found via `make html`
msgpack_rpc/channel.c:
ELOG already prefixes each line with "error @ ..."
This commit pulls the some environment-variable handling functions out of
misc1.c and in to os/env.c. Previously submited as #1231, this is the start of
a patch series that does that work based on a more up-to-date master branch.
Major tasks accomplished:
- move functions and fix includes
- fix clint/clang analysis warnings
- correct documentation comments
- Read TEST_TAG/TEST_FILTER env vars from cmake/RunTests.cmake. Setting these
environment variables will pass --tags/--filter to busted, which can used to
filter which tests are executed.
- Remove calls to nvim msgpack-rpc API outside tests. This removes the
requirement of having a static `clear` call in test/functional/helpers.lua
- Use the new busted command-line option "--lazy" to ensure the setup/teardown
hooks are only executed when a suite runs at least one test.
Now its possible to run/debug a single test like this:
```sh
TEST_FILTER='some test string' make test
```
Which will only run tests containing "some test string" in the title.
Another option is:
```sh
TEST_TAG=some-tag make test
```
After putting #some-tag into the test title. This also improves debugging
experience because there will be no unnecessary gdbserver instances whe GDB=1 is
passed.
This is can be used for spawning nvim outside a test context. Also refactor
screen.lua to use this function when loading the color map(It is better because
the GDB/VALGRIND environment variables are ignored)
Despite the +/- prefix, the majority of these features have been made
non-optional at compile time, so their presence here is misleading.
Also mention `:h vim-differences` to make it clear our that many
features are non-optional.
Problem : Resource leak @ 94, 98, 102.
Diagnostic : Real issue.
Rationale : Coverity doesn't know that uv_pipe_open will save file
descriptor to close them later. So, it signals file
descriptors being leaked. This would then seem like a false
positive we can fix by teaching coverity about uv_pipe_open
through model file.
But then we realize that the above is only true if
uv_pipe_open succeeds. It it fails, then descriptors are
really being leaked, which is why this is considered a real
issue and not a false positive after all.
Resolution : Add error handling to correctly close descriptors if
uv_pipe_open fails at any point.
Add model for uv_pipe_open so that Coverity knows it will
save descriptors when no error.
Helped-by: oni-link <knil.ino@gmail.com>
Problem : Unchecked return value from library @ 91.
Diagnostic : Real issue.
Rationale : fcntl can fail, which is not being checked.
Resolution : Add corresponding error handling.
Helped-by: oni-link <knil.ino@gmail.com>
Problem : Free of array-typed value @ 3628.
Diagnostic : False positive.
Rationale : expand_shell_cmd() is called with a mock value for file
(*file = (char_u **)""). That means we want file to be
filled with a new value. We can't use *file = NULL because
that means we don't want file to be filled.
Now, coverity incorrectly thinks that sentinel value is the
one we are freeing up at some other later point, which is
not the case.
Resolution : Assert that, when we are freeing *file, its value is
different than the sentinel one.
Problem : String not null terminated @ 1543.
Diagnostic : Real issue.
Rationale : We are reading a struct block0, which contains some string
fields, from a file, without checking for string fields to
be correctly terminated. That could cause a buffer overrun
if file has somehow been garbled.
Resolution : Add string fields check for nul termination.
Mark issue as intentional (there seems to be no way of
teaching coverity about read_eintr being ok that way).
Helped-by: oni-link <knil.ino@gmail.com>
This requires a couple of extra modules that are not installed by
default, and it requires capturing stdout of the tests--otherwise CMake
output is intermixed with the XML output of busted.
Add check to see if a string contains ], which can result in
cases where wrapping a string in [[...]] breaks. Use [=[...]=] instead
on those strings.
Use [=[...]=] for insert() and expect().
Problem: Cannot append a list of lines to a file.
Solution: Add the append option to writefile(). (Yasuhiro Matsumoto)
https://code.google.com/p/vim/source/detail?r=v7-4-503
-Ported old legacy test over to
test/functional/legacy/writefile_spec.lua
-Tests for mapping and signs from the original patch were removed since
they have nothing to do this with feature
Tested with: make oldtest, make test on OS X.
Signed-off-by: Perry Hung <iperry@gmail.com>
The 'binary' mode flag is ignored on all POSIX conforming systems (man 3
fopen). For all the others, BINARY_FILE_IO needs to be set.
Always set BINARY_FILE_IO.
Signed-off-by: Perry Hung <iperry@gmail.com>