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