]> granicus.if.org Git - vim/commitdiff
patch 7.4.1643 v7.4.1643
authorBram Moolenaar <Bram@vim.org>
Thu, 24 Mar 2016 18:14:35 +0000 (19:14 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 24 Mar 2016 18:14:35 +0000 (19:14 +0100)
Problem:    Terminating file name has side effects.
Solution:   Restore the character. (mostly by James McCoy, closes #713)

src/eval.c
src/testdir/test105.in
src/testdir/test105.ok
src/version.c

index 9091f7972fb0b7e2a340a0c4795c05e647ae9a1e..55d61e79bdd03a39c7bee3f3414c95e7930d0612 100644 (file)
@@ -26440,8 +26440,10 @@ repeat:
     if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S')
     {
        /* vim_strsave_shellescape() needs a NUL terminated string. */
+       c = (*fnamep)[*fnamelen];
        (*fnamep)[*fnamelen] = NUL;
        p = vim_strsave_shellescape(*fnamep, FALSE, FALSE);
+       (*fnamep)[*fnamelen] = c;
        if (p == NULL)
            return -1;
        vim_free(*bufp);
index 9921d7ed7c477bd9bedd98c7dd084a831a00cfc1..4cc02614453857beb55f4358f6040494dfe578f6 100644 (file)
@@ -36,6 +36,7 @@ STARTTEST
 :Put fnamemodify('abc''%''def',    ':S'      )
 :Put fnamemodify("abc\ndef",       ':S'      )
 :Put expand('%:r:S') == shellescape(expand('%:r'))
+:Put join([expand('%:r'), expand('%:r:S'), expand('%')], ',')
 :set shell=tcsh
 :Put fnamemodify("abc\ndef",       ':S'      )
 :$put ='vim: ts=8'
index 584f0fe6a02acfe73ed402c14257aaecc736adca..6642bfe4fb0e04c7e61df9292f74e7c3515b36f2 100644 (file)
@@ -26,5 +26,6 @@ fnamemodify('abc'' ''def',    ':S'      )     '''abc''\'''' ''\''''def'''
 fnamemodify('abc''%''def',    ':S'      )      '''abc''\''''%''\''''def'''
 fnamemodify("abc\ndef",       ':S'      )      '''abc^@def'''
 expand('%:r:S') == shellescape(expand('%:r'))  1
+join([expand('%:r'), expand('%:r:S'), expand('%')], ',')       'test105,''test105'',test105.in'
 fnamemodify("abc\ndef",       ':S'      )      '''abc\^@def'''
 vim: ts=8
index 15b6d0dea75042209856c6b9539a94a1f3ea6005..4cd93d2844a53411b8121817e242f8d34e50f860 100644 (file)
@@ -748,6 +748,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1643,
 /**/
     1642,
 /**/