Roman Rakus efcdbe
			     BASH PATCH REPORT
Roman Rakus efcdbe
			     =================
Roman Rakus efcdbe
Roman Rakus efcdbe
Bash-Release:	4.2
Roman Rakus efcdbe
Patch-ID:	bash42-040
Roman Rakus efcdbe
Roman Rakus efcdbe
Bug-Reported-by:	Andrey Zaitsev <jstcdr@gmail.com>
Roman Rakus efcdbe
Bug-Reference-ID:	<CAEZVQT5PJ1Mb_Zh8LT5qz8sv+-9Q6hGfQ5DU9ZxdJ+gV7xBUaQ@mail.gmail.com>
Roman Rakus efcdbe
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-04/msg00144.html
Roman Rakus efcdbe
Roman Rakus efcdbe
Bug-Description:
Roman Rakus efcdbe
Roman Rakus efcdbe
Output redirection applied to builtin commands missed I/O errors if
Roman Rakus efcdbe
they happened when the file descriptor was closed, rather than on write
Roman Rakus efcdbe
(e.g., like with an out-of-space error on a remote NFS file system).
Roman Rakus efcdbe
Roman Rakus efcdbe
Patch (apply with `patch -p0'):
Roman Rakus efcdbe
Roman Rakus efcdbe
*** ../bash-4.2-patched/redir.c	2011-01-02 16:00:31.000000000 -0500
Roman Rakus efcdbe
--- redir.c	2012-04-24 20:42:12.000000000 -0400
Roman Rakus efcdbe
***************
Roman Rakus efcdbe
*** 1092,1099 ****
Roman Rakus efcdbe
  #if defined (BUFFERED_INPUT)
Roman Rakus efcdbe
  	  check_bash_input (redirector);
Roman Rakus efcdbe
! 	  close_buffered_fd (redirector);
Roman Rakus efcdbe
  #else /* !BUFFERED_INPUT */
Roman Rakus efcdbe
! 	  close (redirector);
Roman Rakus efcdbe
  #endif /* !BUFFERED_INPUT */
Roman Rakus efcdbe
  	}
Roman Rakus efcdbe
        break;
Roman Rakus efcdbe
--- 1092,1101 ----
Roman Rakus efcdbe
  #if defined (BUFFERED_INPUT)
Roman Rakus efcdbe
  	  check_bash_input (redirector);
Roman Rakus efcdbe
! 	  r = close_buffered_fd (redirector);
Roman Rakus efcdbe
  #else /* !BUFFERED_INPUT */
Roman Rakus efcdbe
! 	  r = close (redirector);
Roman Rakus efcdbe
  #endif /* !BUFFERED_INPUT */
Roman Rakus efcdbe
+ 	  if (r < 0 && (flags & RX_INTERNAL) && (errno == EIO || errno == ENOSPC))
Roman Rakus efcdbe
+ 	    REDIRECTION_ERROR (r, errno, -1);
Roman Rakus efcdbe
  	}
Roman Rakus efcdbe
        break;
Roman Rakus efcdbe
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
Roman Rakus efcdbe
--- patchlevel.h	Thu Feb 24 21:41:34 2011
Roman Rakus efcdbe
***************
Roman Rakus efcdbe
*** 26,30 ****
Roman Rakus efcdbe
     looks for to find the patch level (for the sccs version string). */
Roman Rakus efcdbe
  
Roman Rakus efcdbe
! #define PATCHLEVEL 39
Roman Rakus efcdbe
  
Roman Rakus efcdbe
  #endif /* _PATCHLEVEL_H_ */
Roman Rakus efcdbe
--- 26,30 ----
Roman Rakus efcdbe
     looks for to find the patch level (for the sccs version string). */
Roman Rakus efcdbe
  
Roman Rakus efcdbe
! #define PATCHLEVEL 40
Roman Rakus efcdbe
  
Roman Rakus efcdbe
  #endif /* _PATCHLEVEL_H_ */