On 4/23/12 6:38 AM, Andrey Zaitsev wrote:

> Bash Version: 4.1
> Patch Level: 2
> Release Status: release
> 
> Description:
> Internal 'echo' command doesn't handle I/O errors on close file when I try
> redirect
> standart output to mounted filesystem without free space.

This is hard for me to test, but see if the attached patch provides the
behavior you'd like.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/
*** ../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;

Reply via email to