bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #17457] "grep -r foo . > somefile" goes into an infinite loop


From: Jim Meyering
Subject: Re: [bug #17457] "grep -r foo . > somefile" goes into an infinite loop
Date: Sat, 06 Feb 2010 15:20:45 +0100

Paolo Bonzini wrote:
> Update of bug #17457 (project grep):
>   <http://savannah.gnu.org/bugs/?17457>
>                   Status:                    None => Invalid
>              Open/Closed:                    Open => Closed
>
> Follow-up Comment #4:
>
> Hmm, this cannot be fixed.  By definition the output file can grow
> indefinitely, and grep will have to read it until EOF.

Actually, how about detecting this and diagnosing
the problem rather than falling into the infloop?

This currently evokes an infloop for me:

    $ seq 1000000 > k
    $ grep 111 k >> k

However, simply detecting when the output FD is also an input FD is
not enough, since this variant does not get stuck:

    $ seq 1000 > k
    $ grep 111 k >> k




reply via email to

[Prev in Thread] Current Thread [Next in Thread]