[plug] grep + xargs = missing separator?

Andrew Furey Andrew.Furey at gmail.com
Thu Sep 9 16:38:28 WST 2004


Hi all, an interesting problem for your Thursday afternoon/evening...

I've got a web interface to help clear out the mail spool (all those
frozen spam bounce messages...). Part of it is parsing the output from
a simple grep call, so I can reproduce the problem on the shell.

If I do
# grep -n -i -2 --binary-files=text "badmailfrom" /var/spool/exim/input/*

it returns

/var/spool/exim/input/19N3nJ-0000sn-00-D-8-    (ultimately generated
from info at dhammaloka.org.au)
/var/spool/exim/input/19N3nJ-0000sn-00-D-9-    SMTP error from remote
mailer after RCPT TO:<pohlian at iinet.net.au>:
/var/spool/exim/input/19N3nJ-0000sn-00-D:10:    host mail.iinet.net.au
[203.0.178.192]: 553 sorry, your envelope sender is in my badmailfrom
list (#5.7.1)
/var/spool/exim/input/19N3nJ-0000sn-00-D-11-
/var/spool/exim/input/19N3nJ-0000sn-00-D-12------- This is a copy of
the message, including all the headers. ------
--
/var/spool/exim/input/19hAM9-00024U-00-D-8-    (ultimately generated
from info at dhammaloka.org.au)
/var/spool/exim/input/19hAM9-00024U-00-D-9-    SMTP error from remote
mailer after RCPT TO:<pohlian at iinet.net.au>:
/var/spool/exim/input/19hAM9-00024U-00-D:10:    host mail.iinet.net.au
[203.0.178.192]: 553 sorry, your envelope sender is in my badmailfrom
list (#5.7.1)
/var/spool/exim/input/19hAM9-00024U-00-D-11-
/var/spool/exim/input/19hAM9-00024U-00-D-12------- This is a copy of
the message, including all the headers. ------
--
/var/spool/exim/input/1BVn2N-0006QS-00-D-8-    (ultimately generated
from info at dhammaloka.org.au)
/var/spool/exim/input/1BVn2N-0006QS-00-D-9-    SMTP error from remote
mailer after RCPT TO:<pohlian at iinet.net.au>:
/var/spool/exim/input/1BVn2N-0006QS-00-D:10:    host mail.iinet.net.au
[203.0.178.192]: 553 sorry, your envelope sender is in my badmailfrom
list (#5.7.1)
/var/spool/exim/input/1BVn2N-0006QS-00-D-11-
/var/spool/exim/input/1BVn2N-0006QS-00-D-12------- This is a copy of
the message, including all the headers. ------
--
/var/spool/exim/input/1BVnFy-0008RM-00-D-8-    (ultimately generated
from info at dhammaloka.org.au)
/var/spool/exim/input/1BVnFy-0008RM-00-D-9-    SMTP error from remote
mailer after RCPT TO:<pohlian at iinet.net.au>:
/var/spool/exim/input/1BVnFy-0008RM-00-D:10:    host mail.iinet.net.au
[203.0.178.192]: 553 sorry, your envelope sender is in my badmailfrom
list (#5.7.1)
/var/spool/exim/input/1BVnFy-0008RM-00-D-11-
/var/spool/exim/input/1BVnFy-0008RM-00-D-12------- This is a copy of
the message, including all the headers. ------

Note the separators (^--\n), which I use to break up the messages in my script.

Having switched to xargs a while ago to get around the shell
max-arguments limitations, if I do

# find /var/spool/exim/input -name \* | xargs grep -n -i -2
--binary-files=text "badmailfrom"

In this particular case, it returns

/var/spool/exim/input/19hAM9-00024U-00-D-8-    (ultimately generated
from info at dhammaloka.org.au)
/var/spool/exim/input/19hAM9-00024U-00-D-9-    SMTP error from remote
mailer after RCPT TO:<pohlian at iinet.net.au>:
/var/spool/exim/input/19hAM9-00024U-00-D:10:    host mail.iinet.net.au
[203.0.178.192]: 553 sorry, your envelope sender is in my badmailfrom
list (#5.7.1)
/var/spool/exim/input/19hAM9-00024U-00-D-11-
/var/spool/exim/input/19hAM9-00024U-00-D-12------- This is a copy of
the message, including all the headers. ------
/var/spool/exim/input/19N3nJ-0000sn-00-D-8-    (ultimately generated
from info at dhammaloka.org.au)
/var/spool/exim/input/19N3nJ-0000sn-00-D-9-    SMTP error from remote
mailer after RCPT TO:<pohlian at iinet.net.au>:
/var/spool/exim/input/19N3nJ-0000sn-00-D:10:    host mail.iinet.net.au
[203.0.178.192]: 553 sorry, your envelope sender is in my badmailfrom
list (#5.7.1)
/var/spool/exim/input/19N3nJ-0000sn-00-D-11-
/var/spool/exim/input/19N3nJ-0000sn-00-D-12------- This is a copy of
the message, including all the headers. ------
--
/var/spool/exim/input/1BVn2N-0006QS-00-D-8-    (ultimately generated
from info at dhammaloka.org.au)
/var/spool/exim/input/1BVn2N-0006QS-00-D-9-    SMTP error from remote
mailer after RCPT TO:<pohlian at iinet.net.au>:
/var/spool/exim/input/1BVn2N-0006QS-00-D:10:    host mail.iinet.net.au
[203.0.178.192]: 553 sorry, your envelope sender is in my badmailfrom
list (#5.7.1)
/var/spool/exim/input/1BVn2N-0006QS-00-D-11-
/var/spool/exim/input/1BVn2N-0006QS-00-D-12------- This is a copy of
the message, including all the headers. ------
/var/spool/exim/input/1BVnFy-0008RM-00-D-8-    (ultimately generated
from info at dhammaloka.org.au)
/var/spool/exim/input/1BVnFy-0008RM-00-D-9-    SMTP error from remote
mailer after RCPT TO:<pohlian at iinet.net.au>:
/var/spool/exim/input/1BVnFy-0008RM-00-D:10:    host mail.iinet.net.au
[203.0.178.192]: 553 sorry, your envelope sender is in my badmailfrom
list (#5.7.1)
/var/spool/exim/input/1BVnFy-0008RM-00-D-11-
/var/spool/exim/input/1BVnFy-0008RM-00-D-12------- This is a copy of
the message, including all the headers. ------

Huh? Two of the separators are missing?!

It doesn't happen very often, just often enough to be quite annoying.
Anyone seen this before?

Thanks,
Andrew

-- 
Linux supports the notion of a command line or a shell for the same
reason that only children read books with only pictures in them.
Language, be it English or something else, is the only tool flexible
enough to accomplish a sufficiently broad range of tasks.
                          -- Bill Garrett



More information about the plug mailing list