Commit Graph

8161 Commits

Author SHA1 Message Date
ZyX
9e9ba14e0e edit: Fix strange code
Based on the flow it looks like ptr could not be NULL here: if ptr_arg is NULL 
ptr is compl_leader, if compl_leader is NULL function exits. This also applies 
to Vim as far as I see.
2017-04-16 19:38:16 +03:00
ZyX
4f0fc1f06a digraph: Fix errors due to has_mbyte and friends being fixed 2017-04-16 19:32:38 +03:00
ZyX
2901921a1b digraph: Ignore false positive
Reversed order is intentional, digraphs allow swapping characters.
2017-04-16 19:30:18 +03:00
ZyX
a096766ee3 diff: Silence -V519
Not exactly a false positive, but previous assignment is a part of the pattern 
“change global, run code which uses it, change global back”.
2017-04-16 19:27:17 +03:00
ZyX
33952a7661 *: Silence some false positives 2017-04-16 19:18:54 +03:00
Justin M. Keyes
77a4f8f235 Merge #6219 from jbradaric/vim-7.4.2170
vim-patch:7.4.{2170,2180,2240,2241,2242}
2017-04-16 16:49:14 +02:00
Nikolai Aleksandrovich Pavlov
d4c7f74ed1 Merge pull request #6493 from ZyX-I/pvs-script
[RFC] scripts: Create script which checks Neovim with PVS-studio
2017-04-16 03:03:38 +03:00
Justin M. Keyes
5c805f4566 Merge #6528 from ZyX-I/revise-malloc-attr
Revise places where FUNC_ATTR_MALLOC is present

Closes #6521
2017-04-15 22:12:31 +02:00
Jurica Bradaric
ec0fabd4d5 eval.c: Code style fixes 2017-04-15 18:48:06 +02:00
ZyX
d76a13bb65 os/shell: Remove FUNC_ATTR_MALLOC from shell_build_argv
Returns an array of allocated strings.
2017-04-15 19:39:53 +03:00
ZyX
ac47e64eca ops: Remove FUNC_ATTR_MALLOC from copy_register
Returned storage has a pointer to a newly allocated array.
2017-04-15 19:25:00 +03:00
ZyX
d191ba1db3 option: Remove FUNC_ATTR_MALLOC from get_winbuf_options
Same as tv_dict_alloc() and additionally it saves some strings inside 
a dictionary.
2017-04-15 19:23:00 +03:00
ZyX
82ba2891ae eval/typval: Remove FUNC_ATTR_MALLOC from tv_list_alloc_ret
Same as tv_list_alloc, but additionally ret_tv receives pointer to the newly 
allocated list.
2017-04-15 19:19:22 +03:00
ZyX
af3579d5f7 eval/typval: Remove FUNC_ATTR_MALLOC from tv_dict_alloc
Allocated dict points to previously allocated dict.
Queue in allocated dict points to itself.
Hashtab in allocated dict points to inside itself.
Allocated dict is saved to gc_first_dict.
2017-04-15 19:18:25 +03:00
ZyX
b9004d7448 eval/typval: Remove FUNC_ATTR_MALLOC from tv_dict_item_copy
Allocated storage may receive pointer to the list after tv_copy().
2017-04-15 19:16:40 +03:00
ZyX
b08b71c728 eval/typval: Remove FUNC_ATTR_MALLOC from tv_list_alloc
Allocated list points to previously allocated list.
Allocated list is saved to gc_first_list.
2017-04-15 19:16:00 +03:00
ZyX
0dddd8a27c os/fileio: Remove FUNC_ATTR_MALLOC for file_open_new
fp contains pointer to rbuffer
2017-04-15 19:13:43 +03:00
Björn Linse
c70ab1a2e2 test: make locale dependent oldtest more reliable (#6526) 2017-04-15 15:06:50 +02:00
James McCoy
a8f7872f44
test_timers.vim: Adjust timing to handle difference in implementation 2017-04-15 08:50:43 -04:00
Björn Linse
12fc1defd6 ops: fix i<c-r> with multi-byte text (#6524) 2017-04-15 11:19:40 +02:00
Justin M. Keyes
58d2ce9bdb test: check_cores(): Escape $TMPDIR path. (#6520)
Lua string:match() considers hyphen to be a special char, we want the
path to be a literal match. Also remove "./", etc.

References #6483
2017-04-14 20:34:54 +02:00
Justin M. Keyes
45b5ebea9d perf: tv_clear(): Cache gettext() result. (#6519)
Closes #6437
2017-04-14 17:41:59 +02:00
Justin M. Keyes
dd391bfca1 Merge #6497 from justinmk/win-quot
win: system('...'): special-case cmd.exe
2017-04-12 03:21:21 +02:00
Justin M. Keyes
7c4e5dfd27 win: os_shell_is_cmdexe() + tests 2017-04-12 02:28:43 +02:00
Rui Abreu Ferreira
d31d177a0c win: default shellxescape, shellxquote to empty
Calling cmd.exe in Windows follows a very different pattern from Vim.
The primary difference is that Vim does a nested call to cmd.exe, e.g.
the following call in Vim

    system('echo a 2>&1')

spawns the following processes

    "C:\Program Files (x86)\Vim\vim80\vimrun" -s C:\Windows\system32\cmd.exe /c (echo a 2^>^&1
        ^>C:\Users\dummy\AppData\Local\Temp\VIoC169.tmp 2^>^&1)
    C:\Windows\system32\cmd.exe /c C:\Windows\system32\cmd.exe /c (echo a 2^>^&1
        ^>C:\Users\dummy\AppData\Local\Temp\VIo3C6C.tmp 2^>^&1)
    C:\Windows\system32\cmd.exe  /c (echo a 2>&1
        >C:\Users\dummy\AppData\Local\Temp\VIo3C6C.tmp 2>&1)

The escaping with ^ is needed because cmd.exe calls itself and needs to
preserve the special metacharacters for the last call. However in nvim
no nested call is made, system('') spawns a single cmd.exe process.
Setting shellxescape to "" disables escaping with ^.

The previous default for shellxquote=( wrapped any command in
parenthesis, in Vim this is more meaningful due to the use of tempfiles
to store the output and redirection (also see &shellquote). There is
a slight benefit in having the default be empty because some expressions
that run in console will not run within parens e.g. due to unbalanced
double quotes

    system('echo "a b')
2017-04-12 02:10:34 +02:00
Rui Abreu Ferreira
f3cc843755 win: libuv_process_spawn(): special-case cmd.exe
Disable CommandLineToArgvW-standard quoting for cmd.exe.

libuv assumes spawned processes follow the convention expected by
CommandLineToArgvW(). But cmd.exe is non-conformant, so for cmd.exe:
- With system([]), the caller has full control (and responsibility) to
  quote arguments correctly.
- With system(''), shell* options are used.

libuv quoting is disabled if argv[0] is:
- cmd.exe
- cmd
- $COMSPEC resolving to a path with filename cmd.exe

Closes #6329
References #6387
2017-04-12 02:10:34 +02:00
Rui Abreu Ferreira
799443c994 win/test: Enable more system() tests 2017-04-12 02:10:33 +02:00
Justin M. Keyes
f7611d74e7 win: vim_strsave_shellescape: Handle 'shellslash'.
From Vim, misc2.c:vim_strsave_shellescape
2017-04-12 02:10:33 +02:00
Justin M. Keyes
d6e5f94ae9 win: defaults: 'shellredir', 'shellxquote', 'shellxescape' 2017-04-12 01:35:49 +02:00
Felipe Oliveira Carvalho
2d72d85b23 refactor: pos_T macros to functions (#6496) 2017-04-11 22:44:48 +02:00
Björn Linse
1b94852ccb Merge pull request #6495 from bfredl/localefix
run Turkish locale tests on travis and make the tests more reliable
2017-04-11 12:38:58 +02:00
Björn Linse
69775f603f ci: install Turkish locale and make locale tests more reliable 2017-04-11 10:24:19 +02:00
Justin M. Keyes
337299c808 Merge #6490 from justinmk/test
Closes #6487
2017-04-11 03:14:10 +02:00
Justin M. Keyes
de378477cc ci/appveyor: fix cache pattern 2017-04-11 02:37:39 +02:00
Justin M. Keyes
119f0ca854 test: helpers.execute() => helpers.feed_command() 2017-04-11 02:37:39 +02:00
Justin M. Keyes
dab3f86d09 win/test: Enable recover_spec.lua 2017-04-11 02:37:39 +02:00
erw7
4a63d9e5f8 win: mch_open_rw: specify S_IWRITE #6487
On Windows, `mch_open_rw` is not actually doing what it claims. This
manifests as "E301: Oops, lost the swap file !!!" when filename is
changed with :file {name}.

Steps to reproduce (covered by test/functional/ex_cmds/file_spec.lua):
    nvim -u NONE
    :edit test
    :file test2
    E301 Oops, lost the swap file!!!

From libuv/src/win/fs.c:
    void fs__open(uv_fs_t* req) {
      ...
      attributes |= FILE_ATTRIBUTE_NORMAL;
      if (flags & _O_CREAT) {
        if (!((req->fs.info.mode & ~current_umask) & _S_IWRITE)) {
          attributes |= FILE_ATTRIBUTE_READONLY;
        }
      }
2017-04-11 00:39:12 +02:00
Justin M. Keyes
2d29638744 test: :file {name} 2017-04-11 00:39:12 +02:00
Justin M. Keyes
6cbf290d56 test/rmdir(): fallback to Nvim delete()
Lua has too many pitfalls here:
- os.execute() requires shell-escaping
- os.execute() has breaking changes between Lua 5.1 and 5.2
- No native way in Lua to handle "readonly" etc. on Windows
2017-04-11 00:39:12 +02:00
Justin M. Keyes
0ce9618918 test/rmdir(): Remove readonly attr on Windows. 2017-04-10 22:59:30 +02:00
Justin M. Keyes
9aface8c4d Merge #6489 from ZyX-I/own-output-handler 2017-04-10 15:53:40 +02:00
Justin M. Keyes
fec53f0bdf Merge #6479 from bfredl/tolower
remove vim_tolower/etc functions with broken locale-dependent behavior
2017-04-10 15:23:44 +02:00
ZyX
60ee50ce4b appveyor: Widen .deps cache dependency 2017-04-10 16:17:02 +03:00
ZyX
2a8055a8d9 ci: Make appveyor use new output handler as well 2017-04-10 15:11:41 +03:00
Justin M. Keyes
dd7f41e5a0 Merge #6488 from ZyX-I/coverity-fixes 2017-04-10 14:04:19 +02:00
ZyX
55292685d3 pvscheck: Add --recheck argument 2017-04-10 14:07:26 +03:00
ZyX
2b13c87fa2 pvscheck: Do not use --depth 2017-04-10 13:47:31 +03:00
ZyX
d7086f44f4 pvscheck: Do not trace help 2017-04-10 13:45:33 +03:00
ZyX
3bd11f2911 pvsscript: Use git clone and not git worktree 2017-04-10 13:42:31 +03:00
ZyX
59f0cbc282 pvscheck: Add help 2017-04-10 13:41:09 +03:00