From owner-freebsd-current@FreeBSD.ORG Fri Feb 13 18:58:21 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CC9D116A4CE for ; Fri, 13 Feb 2004 18:58:21 -0800 (PST) Received: from pd2mo3so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id C051143D31 for ; Fri, 13 Feb 2004 18:58:21 -0800 (PST) (envelope-from sdyoung@vt220.org) Received: from pd2mr4so.prod.shaw.ca (pd2mr4so-ser.prod.shaw.ca [10.0.141.107])2003))freebsd-current@freebsd.org; Fri, 13 Feb 2004 19:51:23 -0700 (MST) Received: from pn2ml4so.prod.shaw.ca (pn2ml4so-qfe0.prod.shaw.ca [10.0.121.148]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0HT1008SNZXOA8@l-daemon> for freebsd-current@freebsd.org; Fri, 13 Feb 2004 19:51:24 -0700 (MST) Received: from [10.0.0.2] (h68-144-59-39.cg.shawcable.net [68.144.59.39]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0HT100E1UZXNLK@l-daemon> for freebsd-current@freebsd.org; Fri, 13 Feb 2004 19:51:23 -0700 (MST) Date: Fri, 13 Feb 2004 19:51:23 -0700 From: Steve Young In-reply-to: <200402090704.i1974IVa032065@the-macgregors.org> To: Rob MacGregor Message-id: MIME-version: 1.0 X-Mailer: Apple Mail (2.612) Content-type: text/plain; charset=US-ASCII; format=flowed Content-transfer-encoding: 7BIT References: <200402090704.i1974IVa032065@the-macgregors.org> cc: freebsd-current@freebsd.org Subject: Re: grep bug X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Feb 2004 02:58:21 -0000 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.