From f3560b8e626a528f2b5cc167c00d610ab9546b82 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 12 Jun 2015 16:05:59 -0700 Subject: Correctly un-export an env var when it is shadowed Prior to this fix, if you exported a variable in one scope and then unexported it in the next, it would remain exported. Example: set -gx VAR 1 function foo; set -l VAR; env; end foo Here 'VAR' would be exported to 'env' because we failed to notice that the env var is shadowed by an unexported variable. This occurred at env var computation time, not in env_set! Fixes #2132 --- tests/test3.in | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/test3.in') diff --git a/tests/test3.in b/tests/test3.in index 970741d1..fe20928c 100644 --- a/tests/test3.in +++ b/tests/test3.in @@ -227,6 +227,14 @@ else echo Test 16 fail end +# Test that shadowing with a non-exported variable works +set -gx __fish_test_env17 UNSHADOWED +env | sgrep __fish_test_env17 +function __fish_test_shadow + set -l __fish_test_env17 + env | sgrep __fish_test_env17 ; or echo SHADOWED +end +__fish_test_shadow # clear for other shells set -eU __fish_test_universal_variables_variable_foo -- cgit v1.2.3