|
|
3ef2ca |
To: vim_dev@googlegroups.com
|
|
|
3ef2ca |
Subject: Patch 7.4.272
|
|
|
3ef2ca |
Fcc: outbox
|
|
|
3ef2ca |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
3ef2ca |
Mime-Version: 1.0
|
|
|
3ef2ca |
Content-Type: text/plain; charset=UTF-8
|
|
|
3ef2ca |
Content-Transfer-Encoding: 8bit
|
|
|
3ef2ca |
------------
|
|
|
3ef2ca |
|
|
|
3ef2ca |
Patch 7.4.272
|
|
|
3ef2ca |
Problem: Using just "$" does not cause an error message.
|
|
|
3ef2ca |
Solution: Check for empty environment variable name. (Christian Brabandt)
|
|
|
3ef2ca |
Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok
|
|
|
3ef2ca |
|
|
|
3ef2ca |
|
|
|
3ef2ca |
*** ../vim-7.4.271/src/eval.c 2014-04-29 14:02:42.543919791 +0200
|
|
|
3ef2ca |
--- src/eval.c 2014-04-29 17:33:40.575697949 +0200
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 7798,7804 ****
|
|
|
3ef2ca |
* Get the value of an environment variable.
|
|
|
3ef2ca |
* "arg" is pointing to the '$'. It is advanced to after the name.
|
|
|
3ef2ca |
* If the environment variable was not set, silently assume it is empty.
|
|
|
3ef2ca |
! * Always return OK.
|
|
|
3ef2ca |
*/
|
|
|
3ef2ca |
static int
|
|
|
3ef2ca |
get_env_tv(arg, rettv, evaluate)
|
|
|
3ef2ca |
--- 7798,7804 ----
|
|
|
3ef2ca |
* Get the value of an environment variable.
|
|
|
3ef2ca |
* "arg" is pointing to the '$'. It is advanced to after the name.
|
|
|
3ef2ca |
* If the environment variable was not set, silently assume it is empty.
|
|
|
3ef2ca |
! * Return FAIL if the name is invalid.
|
|
|
3ef2ca |
*/
|
|
|
3ef2ca |
static int
|
|
|
3ef2ca |
get_env_tv(arg, rettv, evaluate)
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 7817,7848 ****
|
|
|
3ef2ca |
len = get_env_len(arg);
|
|
|
3ef2ca |
if (evaluate)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
! if (len != 0)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
! cc = name[len];
|
|
|
3ef2ca |
! name[len] = NUL;
|
|
|
3ef2ca |
! /* first try vim_getenv(), fast for normal environment vars */
|
|
|
3ef2ca |
! string = vim_getenv(name, &mustfree);
|
|
|
3ef2ca |
! if (string != NULL && *string != NUL)
|
|
|
3ef2ca |
! {
|
|
|
3ef2ca |
! if (!mustfree)
|
|
|
3ef2ca |
! string = vim_strsave(string);
|
|
|
3ef2ca |
! }
|
|
|
3ef2ca |
! else
|
|
|
3ef2ca |
! {
|
|
|
3ef2ca |
! if (mustfree)
|
|
|
3ef2ca |
! vim_free(string);
|
|
|
3ef2ca |
|
|
|
3ef2ca |
! /* next try expanding things like $VIM and ${HOME} */
|
|
|
3ef2ca |
! string = expand_env_save(name - 1);
|
|
|
3ef2ca |
! if (string != NULL && *string == '$')
|
|
|
3ef2ca |
! {
|
|
|
3ef2ca |
! vim_free(string);
|
|
|
3ef2ca |
! string = NULL;
|
|
|
3ef2ca |
! }
|
|
|
3ef2ca |
}
|
|
|
3ef2ca |
- name[len] = cc;
|
|
|
3ef2ca |
}
|
|
|
3ef2ca |
rettv->v_type = VAR_STRING;
|
|
|
3ef2ca |
rettv->vval.v_string = string;
|
|
|
3ef2ca |
}
|
|
|
3ef2ca |
--- 7817,7849 ----
|
|
|
3ef2ca |
len = get_env_len(arg);
|
|
|
3ef2ca |
if (evaluate)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
! if (len == 0)
|
|
|
3ef2ca |
! return FAIL; /* can't be an environment variable */
|
|
|
3ef2ca |
!
|
|
|
3ef2ca |
! cc = name[len];
|
|
|
3ef2ca |
! name[len] = NUL;
|
|
|
3ef2ca |
! /* first try vim_getenv(), fast for normal environment vars */
|
|
|
3ef2ca |
! string = vim_getenv(name, &mustfree);
|
|
|
3ef2ca |
! if (string != NULL && *string != NUL)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
! if (!mustfree)
|
|
|
3ef2ca |
! string = vim_strsave(string);
|
|
|
3ef2ca |
! }
|
|
|
3ef2ca |
! else
|
|
|
3ef2ca |
! {
|
|
|
3ef2ca |
! if (mustfree)
|
|
|
3ef2ca |
! vim_free(string);
|
|
|
3ef2ca |
|
|
|
3ef2ca |
! /* next try expanding things like $VIM and ${HOME} */
|
|
|
3ef2ca |
! string = expand_env_save(name - 1);
|
|
|
3ef2ca |
! if (string != NULL && *string == '$')
|
|
|
3ef2ca |
! {
|
|
|
3ef2ca |
! vim_free(string);
|
|
|
3ef2ca |
! string = NULL;
|
|
|
3ef2ca |
}
|
|
|
3ef2ca |
}
|
|
|
3ef2ca |
+ name[len] = cc;
|
|
|
3ef2ca |
+
|
|
|
3ef2ca |
rettv->v_type = VAR_STRING;
|
|
|
3ef2ca |
rettv->vval.v_string = string;
|
|
|
3ef2ca |
}
|
|
|
3ef2ca |
*** ../vim-7.4.271/src/testdir/test_eval.in 2014-04-29 14:02:42.543919791 +0200
|
|
|
3ef2ca |
--- src/testdir/test_eval.in 2014-04-29 17:35:27.243696080 +0200
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 183,188 ****
|
|
|
3ef2ca |
--- 183,195 ----
|
|
|
3ef2ca |
:" script-local function used in Funcref must exist.
|
|
|
3ef2ca |
:so test_eval_func.vim
|
|
|
3ef2ca |
:"
|
|
|
3ef2ca |
+ :" Using $ instead of '$' must give an error
|
|
|
3ef2ca |
+ :try
|
|
|
3ef2ca |
+ : call append($, 'foobar')
|
|
|
3ef2ca |
+ :catch
|
|
|
3ef2ca |
+ :$put =v:exception
|
|
|
3ef2ca |
+ :endtry
|
|
|
3ef2ca |
+ :"
|
|
|
3ef2ca |
:/^start:/+1,$wq! test.out
|
|
|
3ef2ca |
:" vim: et ts=4 isk-=\: fmr=???,???
|
|
|
3ef2ca |
:call getchar()
|
|
|
3ef2ca |
*** ../vim-7.4.271/src/testdir/test_eval.ok 2014-04-29 14:02:42.543919791 +0200
|
|
|
3ef2ca |
--- src/testdir/test_eval.ok 2014-04-29 17:36:41.451694779 +0200
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 345,347 ****
|
|
|
3ef2ca |
--- 345,348 ----
|
|
|
3ef2ca |
func s:Testje exists: 1
|
|
|
3ef2ca |
Bar exists: 1
|
|
|
3ef2ca |
func Bar exists: 1
|
|
|
3ef2ca |
+ Vim(call):E116: Invalid arguments for function append
|
|
|
3ef2ca |
*** ../vim-7.4.271/src/version.c 2014-04-29 15:55:39.443801021 +0200
|
|
|
3ef2ca |
--- src/version.c 2014-04-29 17:31:54.203699814 +0200
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 736,737 ****
|
|
|
3ef2ca |
--- 736,739 ----
|
|
|
3ef2ca |
{ /* Add new patch number below this line */
|
|
|
3ef2ca |
+ /**/
|
|
|
3ef2ca |
+ 272,
|
|
|
3ef2ca |
/**/
|
|
|
3ef2ca |
|
|
|
3ef2ca |
--
|
|
|
3ef2ca |
From "know your smileys":
|
|
|
3ef2ca |
C=}>;*{)) Drunk, devilish chef with a toupee in an updraft,
|
|
|
3ef2ca |
a mustache, and a double chin
|
|
|
3ef2ca |
|
|
|
3ef2ca |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
3ef2ca |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
3ef2ca |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
3ef2ca |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|