aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2019-11-14 00:34:10 -0500
committerJustin M. Keyes <justinkz@gmail.com>2019-11-13 21:34:10 -0800
commit570ee5f404966a6ffd9a5241d91adc6a9f5f2c9d (patch)
treedf891fd283184ca5a18c943a1ddb910e31470d56
parent00dc12c5d8454a2d3c6806710f63bbb446076e96 (diff)
downloadrneovim-570ee5f404966a6ffd9a5241d91adc6a9f5f2c9d.tar.gz
rneovim-570ee5f404966a6ffd9a5241d91adc6a9f5f2c9d.tar.bz2
rneovim-570ee5f404966a6ffd9a5241d91adc6a9f5f2c9d.zip
f_getenv/setenv: Access v_special when v_type is VAR_SPECIAL #11388
Multiple Debian builds were failing these tests: Failures: From test_environ.vim: Found errors in Test_external_env(): function RunTheTest[37]..Test_external_env line 16: Expected '' but got 'FOO=null\n' Found errors in Test_getenv(): function RunTheTest[37]..Test_getenv line 2: Expected v:null but got v:false Found errors in Test_setenv(): function RunTheTest[37]..Test_setenv line 5: Expected v:null but got 'null' This is because nvim has a separate tag (`v_special`) in `typval_T` for special variables, whereas vim re-uses the `v_number` tag. On little-endian architectures, using the incorrect tag is not an issue because the byte representation is the same. However, on big-endian systems this caused the `v_number == kSpecialVarNull` checks to fail, and the non-special code to execute.
-rw-r--r--src/nvim/eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index e08e129656..3621f90511 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -8711,7 +8711,7 @@ static void f_getenv(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (p == NULL) {
rettv->v_type = VAR_SPECIAL;
- rettv->vval.v_number = kSpecialVarNull;
+ rettv->vval.v_special = kSpecialVarNull;
return;
}
rettv->vval.v_string = p;
@@ -15669,7 +15669,7 @@ static void f_setenv(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char *name = tv_get_string_buf(&argvars[0], namebuf);
if (argvars[1].v_type == VAR_SPECIAL
- && argvars[1].vval.v_number == kSpecialVarNull) {
+ && argvars[1].vval.v_special == kSpecialVarNull) {
os_unsetenv(name);
} else {
os_setenv(name, tv_get_string_buf(&argvars[1], valbuf), 1);