diff options
Diffstat (limited to 'builtins/declare.def')
-rw-r--r-- | builtins/declare.def | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/builtins/declare.def b/builtins/declare.def index 86fa728b..580e3fa8 100644 --- a/builtins/declare.def +++ b/builtins/declare.def @@ -264,7 +264,10 @@ declare_internal (list, local_var) { for (any_failed = 0; list; list = list->next) { - pflag = show_name_attributes (list->word->word, nodefs); + if (flags_on & att_function) + pflag = show_func_attributes (list->word->word, nodefs); + else + pflag = show_name_attributes (list->word->word, nodefs); if (pflag) { sh_notfound (list->word->word); @@ -315,7 +318,8 @@ declare_internal (list, local_var) } else #endif - if (STREQ (name, value)) + /* disallow self references at global scope */ + if (STREQ (name, value) && variable_context == 0) { builtin_error (_("%s: nameref variable self references not allowed"), name); assign_error++; |