Re: grep bug

From: Steve Young <sdyoung_at_vt220.org>
Date: Fri, 13 Feb 2004 19:51:23 -0700
On Feb 9, 2004, at 12:04 AM, Rob MacGregor wrote:

> I can confirm this behaviour under 5.2-CURRENT from the 5th of 
> February:
>
> -bash-2.05b$ grep -r foo / >/dev/null
> grep: /dev/network: Permission denied
> grep: /dev/geom.ctl: Permission denied
> grep: /dev/devctl: Permission denied
> grep: /dev/ata: Permission denied
> grep in realloc(): error: allocation failed
> Abort trap (core dumped)
> Feb  9 06:59:59 phoenix kernel: pid 55974 (grep), uid 1001: exited on 
> signal
> 6 (
> core dumped)

   Hi Rob,

   The problem here is that grep is trying to grep /dev/zero and is 
trying to allocate all your memory in the process of handling this 
infinite input.  This will happen when grep is used on any of the /dev 
files that spit out unlimited output, such as /dev/random and the sound 
input device, I suspect.  Arguably grep shouldn't eat up all your 
memory when this happens but that's more of a GNU issue than a FreeBSD 
issue, and really it would be kind of hard to handle 
gracefully/portably.  Have you reported this to the gnu bugs mailing 
address? It may conceivably use 100% CPU but it shouldn't try and grab 
100% memory too.

   Thanks,
   Steve.
Received on Fri Feb 13 2004 - 17:58:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:43 UTC