Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Sep 2014 07:11:45 -0600 (MDT)
From:      Warren Block <wblock@wonkity.com>
To:        David Benfell <benfell@parts-unknown.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: controlled environment for regular expressions?
Message-ID:  <alpine.BSF.2.11.1409020653100.42190@wonkity.com>
In-Reply-To: <20140902061721.GA90979@home.parts-unknown.org>
References:  <20140901204147.GA53086@home.parts-unknown.org> <alpine.BSF.2.11.1409011536560.82026@wonkity.com> <20140902061721.GA90979@home.parts-unknown.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 1 Sep 2014, David Benfell wrote:

> I've been pondering how to respond to this. It's all deeply buried in
> how I sort email, which is with my own mail delivery agent written in
> perl.
>
> The MDA provides the option to call an external program, in this case,
> grep, and sort or not sort a message into the associated Maildir based
> on the exit code.
>
> One of these instances is where I search the email headers with:
>
> /usr/bin/grep "^Subject: Cron"'

There is an extra single quote at the end of that line.

> From the command line, it matches every time on this header:
>
> Subject: Cron <benfell@home> /usr/local/bin/pycardsyncer
>
> and properly sorts the message.
>
> But when this MDA is called either from a cron job or with postfix's
> delivery instruction, it now fails every time.

To see if the problem is with cron, I'd add a test cron job that just 
manually runs the test:

echo "Subject: Cron <benfell@home> /usr/local/bin/pycardsyncer" | /usr/bin/grep -q "^Subject: Cron" && echo "matched"

If that works, it's not a problem with cron or grep, and I'd proceed to 
do that same test but piping the actual test message in another cron 
job.  Maybe also piping it to a file to see if it is being changed 
somehow in terms of whitespace or unescaped characters.

> I haven't modified this MDA in a while. I wrote it years ago. The last
> change I made to the delivery script was in 2011. I've been using it
> continuously for probably over a decade.

I would still suspect underlying things.

Other thoughts:

If the MDA is Perl, why use grep?  Also:
http://www.wonkity.com/~wblock/docs/html/maildrop.html



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.11.1409020653100.42190>