Package: grep
Version: 2.27-1
Severity: normal
Dear Maintainer,
I have a procmail filter that runs:
* ? (echo "$FROM" | /bin/egrep -i -f $SPASTDIR/fromAllow)
and similar filters for toAllow, fromRejects etc. Sometimes -- only
with one file, fromAllow -- this fails on lines that actually match,
and in the procmail verbose log, it says:
procmail: Executing " (echo "$FROM" | $GREP -i -f $SPASTDIR/fromAllow)"
grep: (standard input): Invalid argument
This only started happening recently, and it appears to be a change
in grep. If I replace /bin/grep with the version from Debian stable,
everything works again and I never see that Invalid argument message.
On the other end I replace /bin/grep with the latest from
git://git.savannah.gnu.org/grep.git, that also works.
So I'm guessing this is a bug that was briefly introduced upstream,
but has since been fixed upstream and Debian hasn't yet included
the upstream fix.
The error message is coming from finalize_input () in grep.c.
The path through the code in the case where it fails looks like this:
static void
finalize_input (int fd, struct stat const *st, bool ineof)
{
// ...
if (outleft)
{
// ...
if (seek_failed)
{
if (drain_input (fd, st))
return;
// We don't return there, so we fall through
}
// various other else clauses that don't concern us
}
// ... and we fall through to here, where we generate an error.
suppressible_error (errno);
}
Unfortunately, whatever is causing this doesn't happen from the
command line; if I run
echo "From: User Name " | /bin/egrep -i -f
$SPASTDIR/fromAllow
(assuming that there is a line in fromAllow matching u...@example.com)
it prints what was giving on stdin, with no error message.
Whatever input flushing is failing is only happening when called
from procmail, and then only in the case where there's a match.
Maybe if I understood what finalize_input is actually doing I could
come up with an easier way to reproduce it.
But since the problem is already fixed upstream,
integrating grep 2.27.37-3438 would fix the Debian bug,
and maybe it's not so important to understand more about how to
reproduce it in Debian's 2.27-1. (Meanwhile, anyone affected
by this bug can work around it by building grep from upstream.)
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 4.3.0-1-686 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages grep depends on:
ii dpkg 1.18.18
ii install-info 6.3.0.dfsg.1-1+b1
ii libc6 2.24-8
ii libpcre3 2:8.39-2
grep recommends no packages.
Versions of packages grep suggests:
ii libpcre3 2:8.39-2
-- no debconf information