ntfsprogs: obsoleted
[openwrt/svn-archive/packages.git] / utils / bash / patches / 108-upstream-bash42-008.patch
1 BASH PATCH REPORT
2 =================
3
4 Bash-Release: 4.2
5 Patch-ID: bash42-008
6
7 Bug-Reported-by: Doug McMahon <mc2man@optonline.net>
8 Bug-Reference-ID: <1299441211.2535.11.camel@doug-XPS-M1330>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00050.html
10
11 Bug-Description:
12
13 Bash-4.2 does not attempt to save the shell history on receipt of a
14 terminating signal that is handled synchronously. Unfortunately, the
15 `close' button on most X11 terminal emulators sends SIGHUP, which
16 kills the shell.
17
18 This is a very small patch to save the history in the case that an
19 interactive shell receives a SIGHUP or SIGTERM while in readline and
20 reading a command.
21
22 The next version of bash will do this differently.
23
24 Patch (apply with `patch -p0'):
25
26 --- a/sig.c
27 +++ b/sig.c
28 @@ -46,6 +46,7 @@
29
30 #if defined (READLINE)
31 # include "bashline.h"
32 +# include <readline/readline.h>
33 #endif
34
35 #if defined (HISTORY)
36 @@ -62,6 +63,7 @@ extern int parse_and_execute_level, shel
37 #if defined (HISTORY)
38 extern int history_lines_this_session;
39 #endif
40 +extern int no_line_editing;
41
42 extern void initialize_siglist ();
43
44 @@ -505,7 +507,10 @@ termsig_sighandler (sig)
45 {
46 #if defined (HISTORY)
47 /* XXX - will inhibit history file being written */
48 - history_lines_this_session = 0;
49 +# if defined (READLINE)
50 + if (interactive_shell == 0 || interactive == 0 || (sig != SIGHUP && sig != SIGTERM) || no_line_editing || (RL_ISSTATE (RL_STATE_READCMD) == 0))
51 +# endif
52 + history_lines_this_session = 0;
53 #endif
54 terminate_immediately = 0;
55 termsig_handler (sig);
56 --- a/patchlevel.h
57 +++ b/patchlevel.h
58 @@ -25,6 +25,6 @@
59 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
60 looks for to find the patch level (for the sccs version string). */
61
62 -#define PATCHLEVEL 7
63 +#define PATCHLEVEL 8
64
65 #endif /* _PATCHLEVEL_H_ */