From 35b6783bcd9e3d861a5afaedfcc068b17a21b57d Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Jun 22 2011 14:31:23 +0000 Subject: Don't crash when use `read' with associative array Patch from upstream. Fixes bug #715050. Signed-off-by: Roman Rakus --- diff --git a/bash-4.1-read-assoc-array.patch b/bash-4.1-read-assoc-array.patch new file mode 100644 index 0000000..920a450 --- /dev/null +++ b/bash-4.1-read-assoc-array.patch @@ -0,0 +1,40 @@ +*** ../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)); + + diff --git a/bash.spec b/bash.spec index 6becdbf..80f8591 100644 --- a/bash.spec +++ b/bash.spec @@ -6,7 +6,7 @@ Version: %{baseversion}%{patchleveltag} Name: bash Summary: The GNU Bourne Again shell -Release: 3%{?dist} +Release: 4%{?dist} Group: System Environment/Shells License: GPLv3+ Url: http://www.gnu.org/software/bash @@ -65,7 +65,9 @@ Patch120: bash-4.2-rc2-logout.patch # Static analyzis shows some issues in bash-2.05a-interpreter.patch Patch121: bash-4.2-coverity.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# 715050, Don't crash when use `read' with associative array +# Patch from upstream +Patch122: bash-4.1-read-assoc-array.patch BuildRequires: texinfo bison BuildRequires: ncurses-devel @@ -125,6 +127,8 @@ This package contains documentation files for %{name}. %patch119 -p1 -b .broken_pipe %patch120 -p1 -b .logout %patch121 -p1 -b .coverity +# upstream patch +%patch122 -p0 -b .read-assoc-array echo %{version} > _distribution echo %{release} > _patchlevel @@ -312,6 +316,9 @@ end #%doc doc/*.ps doc/*.0 doc/*.html doc/article.txt %changelog +* Wed Jun 22 2011 Roman Rakus - 4.2.10-4 +- Don't crash when use `read' with associative array (#715050) + * Tue Jun 07 2011 Roman Rakus - 4.2.10-3 - Added $HOME/.local/bin to PATH in .bash_profile (#699812)