Accepting request 37741 from Base:System

Copy from Base:System/bash based on submit request 37741 from user WernerFink

OBS-URL: https://build.opensuse.org/request/show/37741
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/bash?expand=0&rev=55
This commit is contained in:
OBS User autobuild 2010-04-13 19:20:11 +00:00 committed by Git OBS Bridge
commit 0e4d4f6ca4
5 changed files with 50 additions and 151 deletions

18
bash-4.1-array.dif Normal file
View File

@ -0,0 +1,18 @@
Andreas Schwab <schwab@linux-m68k.org> writes:
> $ declare -A a=b; unset a
> *** glibc detected *** /bin/bash: free(): invalid pointer: 0x10091644 ***
And the obvious patch:
--- builtins/declare.def
+++ builtins/declare.def 2010-04-09 17:20:51.000000000 +0000
@@ -512,7 +512,7 @@ declare_internal (list, local_var)
{
/* let bind_{array,assoc}_variable take care of this. */
if (assoc_p (var))
- bind_assoc_variable (var, name, "0", value, aflags);
+ bind_assoc_variable (var, name, savestring ("0"), value, aflags);
else
bind_array_variable (name, 0, value, aflags);
}

View File

@ -14,145 +14,3 @@
} }
#if 0 #if 0
--- xmalloc.c
+++ xmalloc.c 2010-02-24 08:32:51.452626384 +0000
@@ -35,6 +35,11 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
+/* Determine which kind of system this is. */
+#include <signal.h>
+extern int interrupt_immediately;
+extern int signal_is_trapped __P((int));
+
#include "error.h"
#include "bashintl.h"
@@ -94,6 +99,34 @@ allocerr (func, bytes)
#endif /* !HAVE_SBRK */
}
+static void
+block_signals (setp, osetp)
+ sigset_t *setp, *osetp;
+{
+#ifdef HAVE_POSIX_SIGNALS
+ sigfillset (setp);
+ sigemptyset (osetp);
+ sigprocmask (SIG_BLOCK, setp, osetp);
+#else
+# if defined (HAVE_BSD_SIGNALS)
+ *osetp = sigsetmask (-1);
+# endif
+#endif
+}
+
+static void
+unblock_signals (setp, osetp)
+ sigset_t *setp, *osetp;
+{
+#ifdef HAVE_POSIX_SIGNALS
+ sigprocmask (SIG_SETMASK, osetp, (sigset_t *)NULL);
+#else
+# if defined (HAVE_BSD_SIGNALS)
+ sigsetmask (*osetp);
+# endif
+#endif
+}
+
/* Return a pointer to free()able block of memory large enough
to hold BYTES number of bytes. If the memory cannot be allocated,
print an error message and abort. */
@@ -102,15 +135,28 @@ xmalloc (bytes)
size_t bytes;
{
PTR_T temp;
+ sigset_t set, oset;
+ int blocked_sigs;
#if defined (DEBUG)
if (bytes == 0)
internal_warning("xmalloc: size argument is 0");
#endif
+ /* Block all signals in case we are executed from a signal handler. */
+ blocked_sigs = 0;
+ if (interrupt_immediately || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
+ {
+ block_signals (&set, &oset);
+ blocked_sigs = 1;
+ }
+
FINDBRK();
temp = malloc (bytes);
+ if (blocked_sigs)
+ unblock_signals (&set, &oset);
+
if (temp == 0)
allocerr ("xmalloc", bytes);
@@ -123,15 +169,28 @@ xrealloc (pointer, bytes)
size_t bytes;
{
PTR_T temp;
+ sigset_t set, oset;
+ int blocked_sigs;
#if defined (DEBUG)
if (bytes == 0)
internal_warning("xrealloc: size argument is 0");
#endif
+ /* Block all signals in case we are executed from a signal handler. */
+ blocked_sigs = 0;
+ if (interrupt_immediately || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
+ {
+ block_signals (&set, &oset);
+ blocked_sigs = 1;
+ }
+
FINDBRK();
temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
+ if (blocked_sigs)
+ unblock_signals (&set, &oset);
+
if (temp == 0)
allocerr ("xrealloc", bytes);
@@ -145,7 +204,22 @@ xfree (string)
PTR_T string;
{
if (string)
- free (string);
+ {
+ sigset_t set, oset;
+ int blocked_sigs = 0;
+
+ /* Block all signals in case we are executed from a signal handler. */
+ if (interrupt_immediately || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
+ {
+ block_signals (&set, &oset);
+ blocked_sigs = 1;
+ }
+
+ free (string);
+
+ if (blocked_sigs)
+ unblock_signals (&set, &oset);
+ }
}
#ifdef USING_BASH_MALLOC
--- builtins/read.def
+++ builtins/read.def 2010-03-02 16:24:59.070362886 +0000
@@ -387,6 +387,8 @@ read_builtin (list)
input_string. We want to run all the rest and use input_string,
so we have to remove it from the stack. */
remove_unwind_protect ();
+ interrupt_immediately--;
+ terminate_immediately = 0;
run_unwind_frame ("read_builtin");
input_string[i] = '\0'; /* make sure it's terminated */
retval = 128+SIGALRM;

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:04b5bbbf7fd0560da491e1a7610daea5ffc06a2df0b028fce25bd75d8d6c34e0 oid sha256:73424968769484ed4ac52f07dbe882c9710faf8a348c0fffe57d64bbde8ad898
size 1506 size 2814

View File

@ -1,3 +1,24 @@
-------------------------------------------------------------------
Mon Apr 12 11:36:30 CEST 2010 - werner@suse.de
- Add fix for memory double free in array handling
-------------------------------------------------------------------
Tue Apr 6 15:27:24 CEST 2010 - werner@suse.de
- Update bash 4.1 to patch level 5 (related to bnc#522351)
* If command completion is attempted on a word with a quoted globbing
character (e.g., `*' or `?'), bash can reference a NULL pointer and
dump core.
* When running in Posix mode and executing a shell function without local
variables, bash will not propagate a variable in a special builtin's temporary
environment to have global scope.
* When the `read' builtin times out after the timeout specified with -t is
exceeded, it does not reset the flags that tell signal handlers to process
signals immediately instead of deferring their handling. This can result
in unsafe functions being called from signal handlers, which can cause bash
to hang or dump core.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Mar 9 15:34:05 CET 2010 - werner@suse.de Tue Mar 9 15:34:05 CET 2010 - werner@suse.de

View File

@ -28,7 +28,7 @@ Recommends: bash-lang = %bash_vers
Suggests: command-not-found Suggests: command-not-found
AutoReqProv: on AutoReqProv: on
Version: 4.1 Version: 4.1
Release: 4 Release: 5
Summary: The GNU Bourne-Again Shell Summary: The GNU Bourne-Again Shell
Url: http://www.gnu.org/software/bash/bash.html Url: http://www.gnu.org/software/bash/bash.html
Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{bash_vers}.tar.bz2 Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{bash_vers}.tar.bz2
@ -65,6 +65,7 @@ Patch30: readline-6.1-destdir.patch
Patch40: bash-4.1-bash.bashrc.dif Patch40: bash-4.1-bash.bashrc.dif
Patch41: bash-4.1-intr.dif Patch41: bash-4.1-intr.dif
Patch42: bash-4.1-non_void.patch Patch42: bash-4.1-non_void.patch
Patch43: bash-4.1-array.dif
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global _sysconfdir /etc %global _sysconfdir /etc
%global _incdir %{_includedir} %global _incdir %{_includedir}
@ -93,7 +94,7 @@ Group: Documentation/Man
Provides: bash:%{_infodir}/bash.info.gz Provides: bash:%{_infodir}/bash.info.gz
PreReq: %install_info_prereq PreReq: %install_info_prereq
Version: 4.1 Version: 4.1
Release: 4 Release: 5
AutoReqProv: on AutoReqProv: on
%if %suse_version > 1120 %if %suse_version > 1120
BuildArch: noarch BuildArch: noarch
@ -116,7 +117,7 @@ License: GPLv2+
Summary: Include Files mandatory for Development of bash loadable builtins Summary: Include Files mandatory for Development of bash loadable builtins
Group: Development/Languages/C and C++ Group: Development/Languages/C and C++
Version: 4.1 Version: 4.1
Release: 4 Release: 5
AutoReqProv: on AutoReqProv: on
%description -n bash-devel %description -n bash-devel
@ -136,7 +137,7 @@ License: GPLv2+
Summary: Loadable bash builtins Summary: Loadable bash builtins
Group: System/Shells Group: System/Shells
Version: 4.1 Version: 4.1
Release: 4 Release: 5
AutoReqProv: on AutoReqProv: on
%description -n bash-loadables %description -n bash-loadables
@ -205,7 +206,7 @@ Summary: The Readline Library
Group: System/Libraries Group: System/Libraries
Provides: bash:/%{_lib}/libreadline.so.%{rl_major} Provides: bash:/%{_lib}/libreadline.so.%{rl_major}
Version: 6.1 Version: 6.1
Release: 4 Release: 5
Recommends: readline-doc = %{version} Recommends: readline-doc = %{version}
# bug437293 # bug437293
%ifarch ppc64 %ifarch ppc64
@ -234,7 +235,7 @@ Summary: Include Files and Libraries mandatory for Development
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Provides: bash:%{_libdir}/libreadline.a Provides: bash:%{_libdir}/libreadline.a
Version: 6.1 Version: 6.1
Release: 4 Release: 5
Requires: libreadline6 = %{version} Requires: libreadline6 = %{version}
Requires: ncurses-devel Requires: ncurses-devel
Recommends: readline-doc = %{version} Recommends: readline-doc = %{version}
@ -263,7 +264,7 @@ Group: System/Libraries
Provides: readline:%{_infodir}/readline.info.gz Provides: readline:%{_infodir}/readline.info.gz
PreReq: %install_info_prereq PreReq: %install_info_prereq
Version: 6.1 Version: 6.1
Release: 4 Release: 5
AutoReqProv: on AutoReqProv: on
%if %suse_version > 1120 %if %suse_version > 1120
BuildArch: noarch BuildArch: noarch
@ -310,6 +311,7 @@ unset p
%patch40 -p0 -b .bashrc %patch40 -p0 -b .bashrc
%patch41 -p0 -b .intr %patch41 -p0 -b .intr
%patch42 -p0 -b .non_void %patch42 -p0 -b .non_void
%patch43 -p0 -b .array
%patch0 -p0 %patch0 -p0
cd ../readline-%{rl_vers} cd ../readline-%{rl_vers}
for p in ../readline-%{rl_vers}-patches/*; do for p in ../readline-%{rl_vers}-patches/*; do