Roman Rakus 626086
			     BASH PATCH REPORT
Roman Rakus 626086
			     =================
Roman Rakus 626086
Roman Rakus 626086
Bash-Release:	4.2
Roman Rakus 626086
Patch-ID:	bash42-008
Roman Rakus 626086
Roman Rakus 626086
Bug-Reported-by:	Doug McMahon <mc2man@optonline.net>
Roman Rakus 626086
Bug-Reference-ID:	<1299441211.2535.11.camel@doug-XPS-M1330>
Roman Rakus 626086
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00050.html
Roman Rakus 626086
Roman Rakus 626086
Bug-Description:
Roman Rakus 626086
Roman Rakus 626086
Bash-4.2 does not attempt to save the shell history on receipt of a
Roman Rakus 626086
terminating signal that is handled synchronously.  Unfortunately, the
Roman Rakus 626086
`close' button on most X11 terminal emulators sends SIGHUP, which
Roman Rakus 626086
kills the shell.
Roman Rakus 626086
Roman Rakus 626086
This is a very small patch to save the history in the case that an
Roman Rakus 626086
interactive shell receives a SIGHUP or SIGTERM while in readline and
Roman Rakus 626086
reading a command.
Roman Rakus 626086
Roman Rakus 626086
The next version of bash will do this differently.
Roman Rakus 626086
Roman Rakus 626086
Patch (apply with `patch -p0'):
Roman Rakus 626086
Roman Rakus 626086
*** ../bash-4.2-patched/sig.c	Tue Nov 23 08:21:22 2010
Roman Rakus 626086
--- sig.c	Tue Mar  8 21:28:32 2011
Roman Rakus 626086
***************
Roman Rakus 626086
*** 47,50 ****
Roman Rakus 626086
--- 47,51 ----
Roman Rakus 626086
  #if defined (READLINE)
Roman Rakus 626086
  #  include "bashline.h"
Roman Rakus 626086
+ #  include <readline/readline.h>
Roman Rakus 626086
  #endif
Roman Rakus 626086
  
Roman Rakus 626086
***************
Roman Rakus 626086
*** 63,66 ****
Roman Rakus 626086
--- 64,68 ----
Roman Rakus 626086
  extern int history_lines_this_session;
Roman Rakus 626086
  #endif
Roman Rakus 626086
+ extern int no_line_editing;
Roman Rakus 626086
  
Roman Rakus 626086
  extern void initialize_siglist ();
Roman Rakus 626086
***************
Roman Rakus 626086
*** 506,510 ****
Roman Rakus 626086
  #if defined (HISTORY)
Roman Rakus 626086
        /* XXX - will inhibit history file being written */
Roman Rakus 626086
!       history_lines_this_session = 0;
Roman Rakus 626086
  #endif
Roman Rakus 626086
        terminate_immediately = 0;
Roman Rakus 626086
--- 508,515 ----
Roman Rakus 626086
  #if defined (HISTORY)
Roman Rakus 626086
        /* XXX - will inhibit history file being written */
Roman Rakus 626086
! #  if defined (READLINE)
Roman Rakus 626086
!       if (interactive_shell == 0 || interactive == 0 || (sig != SIGHUP && sig != SIGTERM) || no_line_editing || (RL_ISSTATE (RL_STATE_READCMD) == 0))
Roman Rakus 626086
! #  endif
Roman Rakus 626086
!         history_lines_this_session = 0;
Roman Rakus 626086
  #endif
Roman Rakus 626086
        terminate_immediately = 0;
Roman Rakus 626086
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
Roman Rakus 626086
--- patchlevel.h	Thu Feb 24 21:41:34 2011
Roman Rakus 626086
***************
Roman Rakus 626086
*** 26,30 ****
Roman Rakus 626086
     looks for to find the patch level (for the sccs version string). */
Roman Rakus 626086
  
Roman Rakus 626086
! #define PATCHLEVEL 7
Roman Rakus 626086
  
Roman Rakus 626086
  #endif /* _PATCHLEVEL_H_ */
Roman Rakus 626086
--- 26,30 ----
Roman Rakus 626086
     looks for to find the patch level (for the sccs version string). */
Roman Rakus 626086
  
Roman Rakus 626086
! #define PATCHLEVEL 8
Roman Rakus 626086
  
Roman Rakus 626086
  #endif /* _PATCHLEVEL_H_ */