To: vim_dev@googlegroups.com Subject: Patch 8.2.0453 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0453 Problem: Trailing space in job_start() command causes empty argument. Solution: Ignore trailing space. (closes #5851) Files: src/misc2.c, src/testdir/test_channel.vim *** ../vim-8.2.0452/src/misc2.c 2020-02-14 13:21:55.646197062 +0100 --- src/misc2.c 2020-03-26 16:22:52.419327100 +0100 *************** *** 4242,4255 **** * 1: find number of arguments * 2: separate them and build argv[] */ ! for (i = 0; i < 2; ++i) { p = skipwhite(cmd); inquote = FALSE; *argc = 0; ! for (;;) { ! if (i == 1) (*argv)[*argc] = (char *)p; ++*argc; d = p; --- 4242,4255 ---- * 1: find number of arguments * 2: separate them and build argv[] */ ! for (i = 1; i <= 2; ++i) { p = skipwhite(cmd); inquote = FALSE; *argc = 0; ! while (*p != NUL) { ! if (i == 2) (*argv)[*argc] = (char *)p; ++*argc; d = p; *************** *** 4266,4283 **** // Second pass: Remove the backslash. ++p; } ! if (i == 1) *d++ = *p; } ++p; } if (*p == NUL) { ! if (i == 1) *d++ = NUL; break; } ! if (i == 1) *d++ = NUL; p = skipwhite(p + 1); } --- 4266,4283 ---- // Second pass: Remove the backslash. ++p; } ! if (i == 2) *d++ = *p; } ++p; } if (*p == NUL) { ! if (i == 2) *d++ = NUL; break; } ! if (i == 2) *d++ = NUL; p = skipwhite(p + 1); } *** ../vim-8.2.0452/src/testdir/test_channel.vim 2020-03-20 18:20:47.080975621 +0100 --- src/testdir/test_channel.vim 2020-03-26 16:15:42.240633648 +0100 *************** *** 2035,2038 **** --- 2035,2046 ---- unlet $VAR1 endfunc + func Test_job_trailing_space_unix() + CheckUnix + CheckExecutable cat + let job = job_start("cat ", #{in_io: 'null'}) + call WaitForAssert({-> assert_equal("dead", job_status(job))}) + call assert_equal(0, job_info(job).exitval) + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.0452/src/version.c 2020-03-26 16:03:41.574559657 +0100 --- src/version.c 2020-03-26 16:17:24.704328135 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 453, /**/ -- ARTHUR: Be quiet! DENNIS: Well you can't expect to wield supreme executive power just 'cause some watery tart threw a sword at you! ARTHUR: Shut up! DENNIS: I mean, if I went around sayin' I was an empereror just because some moistened bint had lobbed a scimitar at me they'd put me away! The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///