Signal handler fix and man page tweak

Resolves: #799958, #695656

Signed-off-by: Roman Rakus <rrakus@redhat.com>
This commit is contained in:
Roman Rakus 2012-08-28 14:46:34 +02:00
parent e40ab873ee
commit a34730d81f
3 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,12 @@
diff -up bash-4.1/doc/bash.1.manpage_trap bash-4.1/doc/bash.1
--- bash-4.1/doc/bash.1.manpage_trap 2012-08-28 10:06:00.561999092 +0200
+++ bash-4.1/doc/bash.1 2012-08-28 10:06:24.225304505 +0200
@@ -9251,7 +9251,7 @@ being inverted via
These are the same conditions obeyed by the \fBerrexit\fP option.
.if t .sp 0.5
.if n .sp 1
-Signals ignored upon entry to the shell cannot be trapped or reset.
+Signals ignored upon entry to the shell cannot be trapped, reset or listed.
Trapped signals that are not being ignored are reset to their original
values in a subshell or subshell environment when one is created.
The return status is false if any

36
bash-4.2-signal.patch Normal file
View File

@ -0,0 +1,36 @@
diff -up bash-4.1/sig.h.signal bash-4.1/sig.h
--- bash-4.1/sig.h.signal 2009-01-04 20:32:41.000000000 +0100
+++ bash-4.1/sig.h 2012-08-28 11:19:14.920224571 +0200
@@ -96,6 +96,8 @@ do { \
sigprocmask (SIG_BLOCK, &nvar, &ovar); \
} while (0)
+#define UNBLOCK_SIGNAL(ovar) sigprocmask (SIG_SETMASK, &ovar, (sigset_t *)NULL)
+
#if defined (HAVE_POSIX_SIGNALS)
# define BLOCK_CHILD(nvar, ovar) \
BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
diff -up bash-4.1/trap.c.signal bash-4.1/trap.c
--- bash-4.1/trap.c.signal 2009-10-10 23:21:44.000000000 +0200
+++ bash-4.1/trap.c 2012-08-28 10:58:14.746345797 +0200
@@ -516,6 +516,8 @@ set_signal (sig, string)
int sig;
char *string;
{
+ sigset_t set, oset;
+
if (SPECIAL_TRAP (sig))
{
change_signal (sig, savestring (string));
@@ -546,9 +548,10 @@ set_signal (sig, string)
environment in which it is safe to do so. */
if ((sigmodes[sig] & SIG_NO_TRAP) == 0)
{
- set_signal_handler (sig, SIG_IGN);
+ BLOCK_SIGNAL (sig, set, oset);
change_signal (sig, savestring (string));
set_signal_handler (sig, trap_handler);
+ UNBLOCK_SIGNAL (oset);
}
else
change_signal (sig, savestring (string));

View File

@ -6,7 +6,7 @@
Version: %{baseversion}%{patchleveltag}
Name: bash
Summary: The GNU Bourne Again shell
Release: 6%{?dist}
Release: 7%{?dist}
Group: System Environment/Shells
License: GPLv3+
Url: http://www.gnu.org/software/bash
@ -95,6 +95,12 @@ Patch121: bash-4.2-coverity.patch
# Don't call malloc in signal handler
Patch122: bash-4.1-defer-sigchld-trap.patch
# 799958, updated info about trap
Patch123: bash-4.2-manpage_trap.patch
# 695656, block the signal and unblock it after the new handler is installed
Patch124: bash-4.2-signal.patch
BuildRequires: texinfo bison
BuildRequires: ncurses-devel
BuildRequires: autoconf, gettext
@ -184,6 +190,8 @@ This package contains documentation files for %{name}.
%patch120 -p1 -b .logout
%patch121 -p1 -b .coverity
%patch122 -p1 -b .defer_sigchld_trap
%patch123 -p1
%patch124 -p1 -b .signal
echo %{version} > _distribution
echo %{release} > _patchlevel
@ -375,6 +383,10 @@ end
#%doc doc/*.ps doc/*.0 doc/*.html doc/article.txt
%changelog
* Tue Aug 28 2012 Roman Rakus <rrakus@redhat.com> - 4.2.37-7
- Update info about trap in man page
Resolves: #799958
* Wed Aug 22 2012 Ondrej Oprala <ooprala@redhat.com> - 4.2.37-6
- Revert revision 4.2.37-5 - already fixed upstream
@ -386,6 +398,10 @@ end
* Wed Aug 08 2012 Roman Rakus <rrakus@redhat.com> - 4.2.37-4
- Added doc subdir to bash-doc ownership list
Resolves: #846734
- instead of setting the signal handler to SIG_IGN while installing
the new trap handler, block the signal and unblock it after the new handler
is installed
Resolves: #695656
* Tue Jul 24 2012 Roman Rakus <rrakus@redhat.com> - 4.2.37-3
- Increment patchlevel tag