• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision607e5d7968b9594e9f29c3d8708b66b056728121 (tree)
Time2020-03-27 00:30:03
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.0453: trailing space in job_start() command causes empty argument

Commit: https://github.com/vim/vim/commit/7851b1ca992222880df1314684a790f293e11896
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 26 16:27:38 2020 +0100

patch 8.2.0453: trailing space in job_start() command causes empty argument
Problem: Trailing space in job_start() command causes empty argument.
Solution: Ignore trailing space. (closes https://github.com/vim/vim/issues/5851)

Change Summary

Incremental Difference

diff -r 6bef434ae7ba -r 607e5d7968b9 src/misc2.c
--- a/src/misc2.c Thu Mar 26 16:15:04 2020 +0100
+++ b/src/misc2.c Thu Mar 26 16:30:03 2020 +0100
@@ -4242,14 +4242,14 @@
42424242 * 1: find number of arguments
42434243 * 2: separate them and build argv[]
42444244 */
4245- for (i = 0; i < 2; ++i)
4245+ for (i = 1; i <= 2; ++i)
42464246 {
42474247 p = skipwhite(cmd);
42484248 inquote = FALSE;
42494249 *argc = 0;
4250- for (;;)
4250+ while (*p != NUL)
42514251 {
4252- if (i == 1)
4252+ if (i == 2)
42534253 (*argv)[*argc] = (char *)p;
42544254 ++*argc;
42554255 d = p;
@@ -4266,18 +4266,18 @@
42664266 // Second pass: Remove the backslash.
42674267 ++p;
42684268 }
4269- if (i == 1)
4269+ if (i == 2)
42704270 *d++ = *p;
42714271 }
42724272 ++p;
42734273 }
42744274 if (*p == NUL)
42754275 {
4276- if (i == 1)
4276+ if (i == 2)
42774277 *d++ = NUL;
42784278 break;
42794279 }
4280- if (i == 1)
4280+ if (i == 2)
42814281 *d++ = NUL;
42824282 p = skipwhite(p + 1);
42834283 }
diff -r 6bef434ae7ba -r 607e5d7968b9 src/testdir/test_channel.vim
--- a/src/testdir/test_channel.vim Thu Mar 26 16:15:04 2020 +0100
+++ b/src/testdir/test_channel.vim Thu Mar 26 16:30:03 2020 +0100
@@ -2035,4 +2035,12 @@
20352035 unlet $VAR1
20362036 endfunc
20372037
2038+func Test_job_trailing_space_unix()
2039+ CheckUnix
2040+ CheckExecutable cat
2041+ let job = job_start("cat ", #{in_io: 'null'})
2042+ call WaitForAssert({-> assert_equal("dead", job_status(job))})
2043+ call assert_equal(0, job_info(job).exitval)
2044+endfunc
2045+
20382046 " vim: shiftwidth=2 sts=2 expandtab
diff -r 6bef434ae7ba -r 607e5d7968b9 src/version.c
--- a/src/version.c Thu Mar 26 16:15:04 2020 +0100
+++ b/src/version.c Thu Mar 26 16:30:03 2020 +0100
@@ -739,6 +739,8 @@
739739 static int included_patches[] =
740740 { /* Add new patch number below this line */
741741 /**/
742+ 453,
743+/**/
742744 452,
743745 /**/
744746 451,
Show on old repository browser