On 2024-05-12 22:26, Grisha Levit wrote:
Just noticed that with this patch grep has extra output when -m is used
with -[lLq]:
$ echo x | grep -l -m1 .
x
(standard input)
$ echo x | grep -q -m1 .
x
Thanks for letting us know; I've reopened the bug report.
Thanks for the bug report. I installed the attached patch; please give
it a try.From b9a8047099d2388c15e6ad39e7b8c91c6633096c Mon Sep 17 00:00:00 2001
From: Paul Eggert
Date: Fri, 9 Feb 2024 01:06:49 -0800
Subject: [PATCH]
This example file will require multiple reads:
$ printf '%07d\n' {0..98304} > txt
When limiting the match count to 1, the input offset is correctly restored
before grep exits, no matter the output:
$ { grep -m1 . >/dev/zero; head -n1; } < txt
001
$ { grep -m1 . >/dev/null; head -n1; } <