diff --git a/bash-3.2-286861.patch b/bash-3.2-286861.patch new file mode 100644 index 0000000..3ce4d7c --- /dev/null +++ b/bash-3.2-286861.patch @@ -0,0 +1,23 @@ +286861: Wrong input confuses bash's arithmetic unit permanently + +If evalerror (thus longjmp) is called while noeval != 0, it stays nonzero and +assignments cease to work. Such expressions are for example: + +let tmp="foo.a"+0 (only in bash 3.2) +let x=(0?(3?4):3) + +I think we should reset noeval to zero in the evalexp function (or restore +expr_stack[0], probably). + +Written-by: Tomas Janousek + +--- bash-3.2/expr.c.286861 2007-10-23 14:48:38.000000000 +0200 ++++ bash-3.2/expr.c 2007-11-06 18:48:24.000000000 +0100 +@@ -337,6 +337,7 @@ + return (0); + } + ++ noeval = 0; + val = subexpr (expr); + + if (validp) diff --git a/bash-3.2-344411.patch b/bash-3.2-344411.patch new file mode 100644 index 0000000..06c8afa --- /dev/null +++ b/bash-3.2-344411.patch @@ -0,0 +1,46 @@ +344411: $RANDOM stays the same when job executed in the background + +In bash 3.0, random was seeded whenever subshell_environment != 0. + +In bash 3.2, random was seeded whenever subshell_environment != 0 && +seeded_subshell == 0. And when it was seeded, seeded_subshell was set to 1. + +Therefore, in 3.2, if you seeded random in a subshell and in this subshell +invoked another one, it wasn't reseeded as it should have been. A testcase for +that is this: + ( echo $RANDOM; ( echo $RANDOM ); ( echo $RANDOM ) ) + +Tomas's patch (bash-3.2-rng.patch) changed the code to use subshell_level. +subshell_level is not increased for simple async commands, however. So, +although he fixed the previous case, he introduced another. Here's a testcase: + echo $RANDOM; echo $RANDOM & echo $RANDOM & + +I decided to just compare the pids, that should be safe enough. + +Written-by: Tomas Janousek +Reviewed-by: Tomas Mraz + +--- bash-3.2/variables.c.344411 2007-11-06 19:26:42.000000000 +0100 ++++ bash-3.2/variables.c 2007-11-06 20:27:25.000000000 +0100 +@@ -1211,7 +1211,7 @@ + arrayind_t unused; + { + sbrand ((unsigned int)strtoul (value, (char **)NULL, 10)); +- seeded_subshell = subshell_level; ++ seeded_subshell = getpid(); + return (self); + } + +@@ -1221,10 +1221,10 @@ + int rv; + + /* Reset for command and process substitution. */ +- if (seeded_subshell < subshell_level) ++ if (seeded_subshell != getpid()) + { + seed_random (); +- seeded_subshell = subshell_level; ++ seeded_subshell = getpid(); + } + + do diff --git a/bash.spec b/bash.spec index 07b4ff5..6072a73 100644 --- a/bash.spec +++ b/bash.spec @@ -1,7 +1,7 @@ Version: 3.2 Name: bash Summary: The GNU Bourne Again shell (bash) version %{version} -Release: 18%{?dist} +Release: 19%{?dist} Group: System Environment/Shells License: GPLv2+ Url: http://www.gnu.org/software/bash @@ -53,6 +53,9 @@ Patch130: bash-infotags.patch Patch131: bash-cond-rmatch.patch Patch132: bash-ulimit-m.patch Patch133: bash-3.2-rng.patch +Patch134: readline-5.2-inv.patch +Patch135: bash-3.2-286861.patch +Patch136: bash-3.2-344411.patch Requires: mktemp Requires(post): ncurses BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -115,6 +118,9 @@ compliance over previous versions. %patch131 -p1 -b .cond-rmatch %patch132 -p1 -b .ulimit-m %patch133 -p1 -b .rng.patch +%patch134 -p1 -b .readline-inv +%patch135 -p1 -b .286861 +%patch136 -p1 -b .344411 echo %{version} > _distribution echo %{release} > _patchlevel @@ -245,7 +251,7 @@ fi %doc doc/FAQ doc/INTRO doc/article.ms %doc -P examples/bashdb/ examples/functions/ examples/misc/ %doc -P examples/scripts.noah/ examples/scripts.v2/ examples/scripts/ -%doc -P examples/startup-files/ examples/complete/ examples/loadables/ +%doc -P examples/startup-files/ examples/complete/ %config(noreplace) /etc/skel/.b* /bin/sh /bin/bash @@ -256,6 +262,13 @@ fi %doc doc/*.ps doc/*.0 doc/*.html doc/article.txt %changelog +* Tue Nov 06 2007 Tomas Janousek - 3.2-19 +- fix cursor position when prompt has one invisible character (#358231) +- dropped examples/loadables/ from docs, since it wasn't possible to build them + anyway (#174380) +- fix #286861: Wrong input confuses bash's arithmetic unit permanently +- fix #344411: $RANDOM stays the same when job executed in the background + * Fri Aug 31 2007 Pete Graner - 3.2-18 - Added bash32-021 upstream official patch - Added bash32-025 upstream official patch diff --git a/readline-5.2-inv.patch b/readline-5.2-inv.patch new file mode 100644 index 0000000..a98c679 --- /dev/null +++ b/readline-5.2-inv.patch @@ -0,0 +1,15 @@ +fix cursor position when prompt has one invisible character (#358231) + +Written-by: Miroslav Lichvar + +--- bash-3.2/lib/readline/display.c.inv 2007-10-31 17:14:31.000000000 +0100 ++++ bash-3.2/lib/readline/display.c 2007-10-31 17:15:00.000000000 +0100 +@@ -943,7 +943,7 @@ rl_redisplay () + cpos_adjusted == 0 && + _rl_last_c_pos != o_cpos && + _rl_last_c_pos > wrap_offset && +- o_cpos < prompt_last_invisible) ++ o_cpos <= prompt_last_invisible) + _rl_last_c_pos -= wrap_offset; + + /* If this is the line with the prompt, we might need to