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