Subject: bug#25549: 25.1; eshell grep gives inconsistent output

From: <[email-masked]>
Date: Mon, 30 Jan 2017 15:29:59 +0000

On Sun, 29 Jan 2017 12:25:48 -0500, [email-masked] wrote:
> tags 25549 moreinfo unreproducible
> quit
> 
> [email-masked] writes:
> 
>> When using grep on a large file in eshell, the output is sometimes
>>   inconsistent. For example, when grepping for a string in my
>> server's apache2 access log (~5 MB) I got anywhere from around 200 to
>> around 1300 results, just running the same grep command over and over
>> (the file itself was not changing significantly).
>>
>> The bug cannot be consistently reproduced, but has happened in multiple
>> situations and others have reportedly reproduced it per discussion on
>> reddit
>>
(https://www.reddit.com/r/emacs/comments/5qbd70/trampeshellgrep_returning_wildly_different/).
> 
> Could you give some hints on what is needed to reproduce this?  Is it
> the size of the grepped file?  Number of matches?  Are there some
> non-ascii characters in the file?  Is Tramp required (the first post in
> the linked thread mentions it, but some other comments seem to suggest
> it's not required)?  You mention the file was not changing
> "significantly", does this happen also when file stays *exactly*
> identical?
> 
> I tried doubling up xdisp.c until it was over 5 MB, but grepping for
"int"
> in eshell returned a consistent number of matches.

It seems I and others were able to reproduce it locally, but it was much
harder to do so.  The problem seems much more pronounced when tramp is
involved.

It also seems to matter that the file is being written to.  I discovered
it when grepping a fairly active apache access log (being written to maybe
40-60 times a minute, on average).  I am able to consistently reproduce the
bug with this file, even when local to the server (though it's far less
pronounced when local).  I have not been successful reproducing it with a
file that is not changing at all.

I have asked the others who confirmed the bug on reddit to comment with
their observations as well.