Subject: bug#23267: suggestion: silently ignore EPIPE errors when SIGPIPE is set to 'ignore'

From: Fredrik Fornwall <[email-masked]>
Date: Sat, 23 Apr 2016 13:13:44 +0200

Even when SIGPIPE has the default behaviour, it seems that there is a
timing issue if grep has the time to treat EPIPE as an error before
the process being killed due to the delivery of the signal.

This seems to happen easily when running on Android (perhaps due to
slower signal delivery, or relatively faster output, or how it runs on
a multi-cpu setup), as seen from the below run:

$ seq 9999 |grep -v xxx |head -1
1
grep: write error: Broken pipe

This would motivate silently ignoring EPIPE to avoid having different
behaviour depending on timing issues. See also
http://superuser.com/questions/554855/how-can-i-fix-a-broken-pipe-error.