Skip to content

Commit 4c48cf3

Browse files
committed
f_getenv/setenv: Access v_special when v_type is VAR_SPECIAL
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.
1 parent e2cc5fe commit 4c48cf3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/nvim/eval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8492,7 +8492,7 @@ static void f_getenv(typval_T *argvars, typval_T *rettv, FunPtr fptr)
84928492

84938493
if (p == NULL) {
84948494
rettv->v_type = VAR_SPECIAL;
8495-
rettv->vval.v_number = kSpecialVarNull;
8495+
rettv->vval.v_special = kSpecialVarNull;
84968496
return;
84978497
}
84988498
rettv->vval.v_string = p;
@@ -15441,7 +15441,7 @@ static void f_setenv(typval_T *argvars, typval_T *rettv, FunPtr fptr)
1544115441
const char *name = tv_get_string_buf(&argvars[0], namebuf);
1544215442

1544315443
if (argvars[1].v_type == VAR_SPECIAL
15444-
&& argvars[1].vval.v_number == kSpecialVarNull) {
15444+
&& argvars[1].vval.v_special == kSpecialVarNull) {
1544515445
os_unsetenv(name);
1544615446
} else {
1544715447
os_setenv(name, tv_get_string_buf(&argvars[1], valbuf), 1);

0 commit comments

Comments
 (0)