mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-25 02:01:15 -03:00
Don't overwrite unrelated variables with for-loop-variables
for-loops that were not inside a function could overwrite global
and universal variables with the loop variable. Avoid this by making
for-loop-variables local variables in their enclosing scope.
This means that if someone does:
set a global
for a in local; end
echo $a
The local $a will shadow the global one (but not be visible in child
scopes). Which is surprising, but less dangerous than the previous
behavior.
The detection whether the loop is running inside a function was failing
inside command substitutions. Remove this special handling of functions
alltogether, it's not needed anymore.
Fixes #6480
This commit is contained in:
@@ -66,7 +66,6 @@ class parse_execution_context_t {
|
||||
wcstring get_source(const parse_node_t &node) const;
|
||||
tnode_t<grammar::plain_statement> infinite_recursive_statement_in_job_list(
|
||||
tnode_t<grammar::job_list> job_list, wcstring *out_func_name) const;
|
||||
bool is_function_context() const;
|
||||
|
||||
// Expand a command which may contain variables, producing an expand command and possibly
|
||||
// arguments. Prints an error message on error.
|
||||
|
||||
Reference in New Issue
Block a user