delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/06/00:04:40

Date: Fri, 5 Dec 1997 20:57:25 -0800 (PST)
Message-Id: <199712060457.UAA07816@adit.ap.net>
Mime-Version: 1.0
To: Stefano Brozzi <brozzis AT mag00 DOT cedi DOT unipr DOT it>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: grep misbehaviour

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019