bash/bash-4.1-read-assoc-array.patch

41 lines
1010 B
Diff
Raw Normal View History

*** ../bash-4.2-patched/builtins/read.def 2011-01-04 11:43:36.000000000 -0500
--- builtins/read.def 2011-06-21 10:31:02.000000000 -0400
***************
*** 456,460 ****
add_unwind_protect (xfree, input_string);
interrupt_immediately++;
- terminate_immediately++;
unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe;
--- 456,459 ----
***************
*** 513,516 ****
--- 512,516 ----
if (retval <= 0)
{
+ CHECK_TERMSIG;
eof = 1;
break;
***************
*** 623,627 ****
interrupt_immediately--;
- terminate_immediately--;
#if defined (ARRAY_VARS)
--- 623,626 ----
***************
*** 643,646 ****
--- 642,651 ----
return EXECUTION_FAILURE; /* readonly or noassign */
}
+ if (assoc_p (var))
+ {
+ builtin_error (_("%s: cannot convert associative to indexed array"), arrayname);
+ xfree (input_string);
+ return EXECUTION_FAILURE; /* existing associative array */
+ }
array_flush (array_cell (var));