summaryrefslogtreecommitdiff
blob: e8a5b4fd73acf11047c9418344e81dfd6635bca4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00206.html

*** ../bash-4.0/builtins/declare.def	2009-01-04 14:32:22.000000000 -0500
--- builtins/declare.def	2009-02-26 11:40:16.000000000 -0500
***************
*** 296,299 ****
--- 296,306 ----
        if (t = strchr (name, '['))	/* ] */
  	{
+ 	  /* If offset != 0 we have already validated any array reference */
+ 	  if (offset == 0 && valid_array_reference (name) == 0)
+ 	    {
+ 	      sh_invalidid (name);
+ 	      assign_error++;
+ 	      NEXT_VARIABLE ();
+ 	    }
  	  subscript_start = t;
  	  *t = '\0';
***************
*** 485,489 ****
  	  /* declare -a name[[n]] or declare name[n] makes name an indexed
  	     array variable. */
! 	  else if ((making_array_special || (flags_on & att_array)) && array_p (var) == 0)
  	    var = convert_var_to_array (var);
  #endif /* ARRAY_VARS */
--- 492,496 ----
  	  /* declare -a name[[n]] or declare name[n] makes name an indexed
  	     array variable. */
! 	  else if ((making_array_special || (flags_on & att_array)) && array_p (var) == 0 && assoc_p (var) == 0)
  	    var = convert_var_to_array (var);
  #endif /* ARRAY_VARS */