To: vim_dev@googlegroups.com Subject: Patch 8.2.3393 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3393 Problem: Escaping for fish shell is skipping some characters. Solution: Escape character after backslash if needed. (Jason Cox, closes #8827) Files: src/strings.c, src/testdir/test_shell.vim *** ../vim-8.2.3392/src/strings.c 2021-08-30 19:57:31.237438783 +0200 --- src/strings.c 2021-09-01 14:27:48.507193045 +0200 *************** *** 281,286 **** --- 281,287 ---- { *d++ = '\\'; *d++ = *p++; + continue; } MB_COPY_CHAR(p, d); *** ../vim-8.2.3392/src/testdir/test_shell.vim 2021-08-29 12:36:43.301865015 +0200 --- src/testdir/test_shell.vim 2021-09-01 14:27:48.507193045 +0200 *************** *** 61,81 **** for e in shells exe 'set shell=' .. e[0] if e[0] =~# '.*csh$' || e[0] =~# '.*csh.exe$' ! let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%# \\'" ! let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\# \\'" elseif e[0] =~# '.*powershell$' || e[0] =~# '.*powershell.exe$' \ || e[0] =~# '.*pwsh$' || e[0] =~# '.*pwsh.exe$' ! let str1 = "'cmd \"arg1\" ''arg2'' !%# \\'" ! let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\# \\'" elseif e[0] =~# '.*fish$' || e[0] =~# '.*fish.exe$' ! let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\\\'" ! let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\\\'" else ! let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\'" ! let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\'" endif ! call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%# \\"), e[0]) ! call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%# \\", 1), e[0]) " Try running an external command with the shell. if executable(e[0]) --- 61,81 ---- for e in shells exe 'set shell=' .. e[0] if e[0] =~# '.*csh$' || e[0] =~# '.*csh.exe$' ! let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%# \\'\\'' \\\\! \\% \\#'" ! let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\# \\'\\'' \\\\\\! \\\\% \\\\#'" elseif e[0] =~# '.*powershell$' || e[0] =~# '.*powershell.exe$' \ || e[0] =~# '.*pwsh$' || e[0] =~# '.*pwsh.exe$' ! let str1 = "'cmd \"arg1\" ''arg2'' !%# \\'' \\! \\% \\#'" ! let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\# \\'' \\\\! \\\\% \\\\#'" elseif e[0] =~# '.*fish$' || e[0] =~# '.*fish.exe$' ! let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\\\'\\'' \\\\! \\\\% \\\\#'" ! let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\\\'\\'' \\\\\\! \\\\\\% \\\\\\#'" else ! let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\'\\'' \\! \\% \\#'" ! let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\'\\'' \\\\! \\\\% \\\\#'" endif ! call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%# \\' \\! \\% \\#"), e[0]) ! call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%# \\' \\! \\% \\#", 1), e[0]) " Try running an external command with the shell. if executable(e[0]) *** ../vim-8.2.3392/src/version.c 2021-09-01 13:03:31.422768900 +0200 --- src/version.c 2021-09-01 14:27:19.795268231 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3393, /**/ -- I once paid $12 to peer at the box that held King Tutankhamen's little bandage-covered midget corpse at the De Young Museum in San Francisco. I remember thinking how pleased he'd be about the way things turned out in his afterlife. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///