Mail Archives: djgpp/1997/12/06/00:04:40
At 06:08 12/5/1997 +0100, Stefano Brozzi wrote:
>My grep 2.1 has the following problem:
>the instruction:
>
>grep -C something *
>
>if there is a binary file in the search-path,
>produces the following error at evry line printed:
>
>grep: writing output: No space left on drive (ENOSPC)
This is a known problem. The cause is that `grep' writes the entire line to
stdout, regardless of whether it is binary or text. However, when stdout is
not redirected, it goes to DOS's CON device. For some reason, CON always
behaves like text is coming at it: when it receives the ^Z EOF character, it
stops writing. DOS then returns the count of characters written. DJGPP
notices that this is less than the number of characters written, and sets
`errno' to ENOSPC, since a full disk is the usual cause of short writes.
`grep' notices that and gives the error message. Since it's mainly DOS's
fault, no fix is evident.
Solutions: (1) ignore it. The error messages go to stderr and can be
separated out if necessary. This will not be a problem if you redirect
stdout to a file. (2) Don't try to grep binary files.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -