[SCM] Vim packaging branch, maint/lenny, updated. debian/7.1.314-3-51-g209709e
James Vega
jamessan at debian.org
Sun Oct 12 06:29:18 UTC 2008
The following commit has been merged in the maint/lenny branch:
commit 48b57e0b85d1d45eef387dc769657425a21bdd3d
Author: James Vega <jamessan at debian.org>
Date: Thu Oct 9 23:46:30 2008 -0400
[7.2c.002] fnameescape() doesn't handle a leading '+' or '>'
Patch 7.2c.002
Problem: fnameescape() doesn't handle a leading '+' or '>'. (Jan Minar)
Solution: Escape a leading '+' and '>'. And a single '-'.
Conflicts:
runtime/doc/eval.txt
src/ex_getln.c
src/version.c
Signed-off-by: James Vega <jamessan at debian.org>
diff --git a/debian/README b/debian/README
index 3030fab..b8c55f4 100644
--- a/debian/README
+++ b/debian/README
@@ -350,3 +350,4 @@ Individual patches for Vim 7.1:
20111 7.2a.013 shellescape() does not escape "%" and "#" characters
3465 7.2b.005 shellescape() doesn't take care of "!" and "\n"
1783 7.2b.026 GTK 2 file chooser causes significant slowdown
+ 3402 7.2c.002 fnameescape() doesn't handle a leading '+' or '>'
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 8209be6..1284a4a 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2630,14 +2630,16 @@ fnameescape({string}) *fnameescape()*
Escape {string} for use as file name command argument. All
characters that have a special meaning, such as '%' and '|'
are escaped with a backslash.
- For most systems the characters escaped are "". For systems
- where a backslash appears in a filename, it depends on the
- value of 'isfname'.
+ For most systems the characters escaped are
+ " \t\n*?[{`$\\%#'\"|!<". For systems where a backslash
+ appears in a filename, it depends on the value of 'isfname'.
+ A leading '+' and '>' is also escaped (special after |:edit|
+ and |:write|). And a "-" by itself (special after |:cd|).
Example: >
- :let fname = 'some str%nge|name'
+ :let fname = '+some str%nge|name'
:exe "edit " . fnameescape(fname)
< results in executing: >
- edit some\ str\%nge\|name
+ edit \+some\ str\%nge\|name
fnamemodify({fname}, {mods}) *fnamemodify()*
Modify file name {fname} according to {mods}. {mods} is a
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 928fe20..e039d8e 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -3718,10 +3718,27 @@ vim_strsave_fnameescape(fname, shell)
if ((*p != '[' && *p != '{') || !vim_isfilec(*p))
buf[j++] = *p;
buf[j] = NUL;
- return vim_strsave_escaped(fname, buf);
+ p = vim_strsave_escaped(fname, buf);
#else
- return vim_strsave_escaped(fname, shell ? SHELL_ESC_CHARS : PATH_ESC_CHARS);
+ p = vim_strsave_escaped(fname, shell ? SHELL_ESC_CHARS : PATH_ESC_CHARS);
+ if (shell && csh_like_shell() && p != NULL)
+ {
+ char_u *s;
+
+ /* For csh and similar shells need to put two backslashes before '!'.
+ * One is taken by Vim, one by the shell. */
+ s = vim_strsave_escaped(p, (char_u *)"!");
+ vim_free(p);
+ p = s;
+ }
#endif
+
+ /* '>' and '+' are special at the start of some commands, e.g. ":edit" and
+ * ":write". "cd -" has a special meaning. */
+ if (*p == '>' || *p == '+' || (*p == '-' && p[1] == NUL))
+ escape_fname(&p);
+
+ return p;
}
/*
--
Vim packaging
More information about the pkg-vim-maintainers
mailing list