On 12/13/25 4:03 AM, Ihar Hrachyshka wrote:
> When `grep -q` is used in a pipeline, it will exit on a first match and
> not wait for its upstream pipeline component to complete. The upstream
> command may keep producing stdout. If the upstream command attempts to
> write to its stdout after `grep -q` exited, it will receive SIGPIPE. In
> this scenario, the upstream command may print an error to stderr.
> 
> Specifically, `grep` may write: `grep: write error: Broken pipe`.
> 
> Since AT_CHECK with implicit stderr argument expects empty stderr,
> running AT_CHECK on a pipeline that chains multiple `grep` calls, with
> the last component being `grep -q`, may result in a spurious test
> failure, depending on the order of `close` calls on stdin and stdout of
> the pipeline component commands.
> 
> When `grep -q` is used and we expect it to return 0, we usually don't
> care if its upstream command produces more output (either stdout or
> stderr). As long as there's a match, `grep -q` - and the AT_CHECK check
> - should succeed.
> 
> This patch updates all AT_CHECK calls that:
> 
> - use a pipeline with multiple `grep` components;
> - with the last pipeline component being `grep -q`;
> - expect a match (making `grep -q` exit early).
> 
> These calls are updated to explicitly `[ignore]` stderr from the
> pipeline.
> 
> Signed-off-by: Ihar Hrachyshka <[email protected]>
> ---

Hi Ihar,

Thanks for the patch!  Applied to main and all stable branches down to
24.03.

Regards,
Dumitru

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to