Skip to content

Commit d4caf5c

Browse files
committed
patch 7.4.1643
Problem: Terminating file name has side effects. Solution: Restore the character. (mostly by James McCoy, closes #713)
1 parent 6a08454 commit d4caf5c

4 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/eval.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26440,8 +26440,10 @@ modify_fname(
2644026440
if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S')
2644126441
{
2644226442
/* vim_strsave_shellescape() needs a NUL terminated string. */
26443+
c = (*fnamep)[*fnamelen];
2644326444
(*fnamep)[*fnamelen] = NUL;
2644426445
p = vim_strsave_shellescape(*fnamep, FALSE, FALSE);
26446+
(*fnamep)[*fnamelen] = c;
2644526447
if (p == NULL)
2644626448
return -1;
2644726449
vim_free(*bufp);

src/testdir/test105.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ STARTTEST
3636
:Put fnamemodify('abc''%''def', ':S' )
3737
:Put fnamemodify("abc\ndef", ':S' )
3838
:Put expand('%:r:S') == shellescape(expand('%:r'))
39+
:Put join([expand('%:r'), expand('%:r:S'), expand('%')], ',')
3940
:set shell=tcsh
4041
:Put fnamemodify("abc\ndef", ':S' )
4142
:$put ='vim: ts=8'

src/testdir/test105.ok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ fnamemodify('abc'' ''def', ':S' ) '''abc''\'''' ''\''''def'''
2626
fnamemodify('abc''%''def', ':S' ) '''abc''\''''%''\''''def'''
2727
fnamemodify("abc\ndef", ':S' ) '''abc^@def'''
2828
expand('%:r:S') == shellescape(expand('%:r')) 1
29+
join([expand('%:r'), expand('%:r:S'), expand('%')], ',') 'test105,''test105'',test105.in'
2930
fnamemodify("abc\ndef", ':S' ) '''abc\^@def'''
3031
vim: ts=8

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1643,
751753
/**/
752754
1642,
753755
/**/

0 commit comments

Comments
 (0)