Alexey Shipunov wrote:
it does not explain why grep 2.5.4 has no problem with this file
Your test case relies on undefined behavior. In such cases, the behavior might be want you want, and it might not. Although 2.5.4 happened to work the way you wanted, its behavior was not guaranteed and had some other downsides, which is why it was changed.