diff options
author | David Adam <zanchey@ucc.gu.uwa.edu.au> | 2014-10-06 15:10:56 +0800 |
---|---|---|
committer | David Adam <zanchey@ucc.gu.uwa.edu.au> | 2014-10-06 15:18:03 +0800 |
commit | f85ec782a0f8aaae84e8730a6847748f03f1256f (patch) | |
tree | 7113f29109ca32e22df49a1c02dd459165fffab4 /builtin_set.cpp | |
parent | 9df0bcea99beb8d1960835b17e9723261fbb7986 (diff) |
set: warn on setting a universal variable when a global is active
Closes #806.
Diffstat (limited to 'builtin_set.cpp')
-rw-r--r-- | builtin_set.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin_set.cpp b/builtin_set.cpp index eb4f5eda..0434311b 100644 --- a/builtin_set.cpp +++ b/builtin_set.cpp @@ -807,6 +807,16 @@ static int builtin_set(parser_t &parser, wchar_t **argv) } } + /* Check if we are setting variables above the effective scope. + See https://github.com/fish-shell/fish-shell/issues/806 + */ + + env_var_t global_dest = env_get_string(dest, ENV_GLOBAL); + if (universal && ! global_dest.missing()) + { + append_format(stderr_buffer, _(L"%ls: Warning: universal scope selected, but a global variable %ls exists.\n"), L"set", dest); + } + free(dest); if (retcode == STATUS_BUILTIN_OK && preserve_incoming_failure_exit_status) |