bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Empty array referenced by indirection reports unbound variable


From: konsolebox
Subject: Re: Empty array referenced by indirection reports unbound variable
Date: Thu, 8 Apr 2021 06:56:55 +0800

On Thu, Apr 8, 2021 at 2:44 AM Chet Ramey <chet.ramey@case.edu> wrote:
> Indirection does not check whether or not the variable it's indirecting
> is $@/$* or ${array[@/*]}. It simply goes by the return value.

It looks like it can easily be fixed with this:

diff --git a/subst.c b/subst.c
index 4f12f22d..cc9a6803 100644
--- a/subst.c
+++ b/subst.c
@@ -9245,7 +9245,13 @@ parameter_brace_expand (string, indexp, quoted,
pflags, quoted_dollar_atp, conta
     }

 #if defined (ARRAY_VARS)
-  if (valid_array_reference (name, 0))
+  if (want_indir)
+    {
+      if (*contains_dollar_at) {
+    all_element_arrayref = 1;
+      }
+    }
+  else if (valid_array_reference (name, 0))
     {
       int qflags;
       char *t;


-- 
konsolebox



reply via email to

[Prev in Thread] Current Thread [Next in Thread]