Date: Mon, 09 Feb 2004 15:32:48 +0100 From: des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=) To: Barney Wolff <barney@databus.com> Cc: Kris Kennaway <kris@obsecurity.org> Subject: Re: grep bug Message-ID: <xzpad3s492n.fsf@dwp.des.no> In-Reply-To: <20040209051116.GA42857@pit.databus.com> (Barney Wolff's message of "Mon, 9 Feb 2004 00:11:16 -0500") References: <20040209023623.GA30071@xor.obsecurity.org> <20040209051116.GA42857@pit.databus.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Barney Wolff <barney@databus.com> writes: > On Sun, Feb 08, 2004 at 06:36:23PM -0800, Kris Kennaway wrote: >> kkenn@rot13:~ 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: /dev/console: Permission denied >> grep in realloc(): error: allocation failed >> ^C^C^CAbort (core dumped) > > grepping /dev/zero seems to fail. /dev/zero will provide grep with infinite amounts of data. So will /dev/random. Yet other device nodes (serial ports for instance) will cause grep to block because they provide neither data nor EOF. The /dev/zero case is a little special because grep tries to read in an entire line, but /dev/zero provides an endless string of zeroes with no EOL in sight. /dev/random, on the other hand, is pretty much guaranteed to provide EOL every 256 bytes on average. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpad3s492n.fsf>