462fb2
			     BASH PATCH REPORT
462fb2
			     =================
462fb2
462fb2
Bash-Release:	4.2
462fb2
Patch-ID:	bash42-045
462fb2
462fb2
Bug-Reported-by:	Stephane Chazelas <stephane.chazelas@gmail.com>
462fb2
Bug-Reference-ID:	<20130218195539.GA9620@chaz.gmail.com>
462fb2
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2013-02/msg00080.html
462fb2
462fb2
Bug-Description:
462fb2
462fb2
The <&n- and >&n- redirections, which move one file descriptor to another,
462fb2
leave the file descriptor closed when applied to builtins or compound
462fb2
commands.
462fb2
462fb2
Patch (apply with `patch -p0'):
462fb2
462fb2
*** ../bash-4.2-patched/redir.c	2013-01-30 11:56:09.000000000 -0500
462fb2
--- redir.c	2013-02-19 09:38:36.000000000 -0500
462fb2
***************
462fb2
*** 1008,1011 ****
462fb2
--- 1008,1021 ----
462fb2
  	      REDIRECTION_ERROR (r, errno, -1);
462fb2
  	    }
462fb2
+ 	  if ((flags & RX_UNDOABLE) && (ri == r_move_input || ri == r_move_output))
462fb2
+ 	    {
462fb2
+ 	      /* r_move_input and r_move_output add an additional close()
462fb2
+ 		 that needs to be undone */
462fb2
+ 	      if (fcntl (redirector, F_GETFD, 0) != -1)
462fb2
+ 		{
462fb2
+ 		  r = add_undo_redirect (redir_fd, r_close_this, -1);
462fb2
+ 		  REDIRECTION_ERROR (r, errno, -1);
462fb2
+ 		}
462fb2
+ 	    }
462fb2
  #if defined (BUFFERED_INPUT)
462fb2
  	  check_bash_input (redirector);
462fb2
462fb2
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
462fb2
--- patchlevel.h	Thu Feb 24 21:41:34 2011
462fb2
***************
462fb2
*** 26,30 ****
462fb2
     looks for to find the patch level (for the sccs version string). */
462fb2
  
462fb2
! #define PATCHLEVEL 44
462fb2
  
462fb2
  #endif /* _PATCHLEVEL_H_ */
462fb2
--- 26,30 ----
462fb2
     looks for to find the patch level (for the sccs version string). */
462fb2
  
462fb2
! #define PATCHLEVEL 45
462fb2
  
462fb2
  #endif /* _PATCHLEVEL_H_ */