Re: grep bug

From: Dag-Erling Smørgrav <des_at_des.no>
Date: Mon, 09 Feb 2004 15:32:48 +0100
Barney Wolff <barney_at_databus.com> writes:
> On Sun, Feb 08, 2004 at 06:36:23PM -0800, Kris Kennaway wrote:
>> kkenn_at_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
-- 
Dag-Erling Smørgrav - des_at_des.no
Received on Mon Feb 09 2004 - 05:33:00 UTC

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