Date: Tue, 2 Sep 2014 12:22:42 -0700 From: David Benfell <benfell@parts-unknown.org> To: Warren Block <wblock@wonkity.com> Cc: freebsd-questions@freebsd.org Subject: Re: controlled environment for regular expressions? Message-ID: <20140902192242.GB34737@home.parts-unknown.org> In-Reply-To: <alpine.BSF.2.11.1409020653100.42190@wonkity.com> References: <20140901204147.GA53086@home.parts-unknown.org> <alpine.BSF.2.11.1409011536560.82026@wonkity.com> <20140902061721.GA90979@home.parts-unknown.org> <alpine.BSF.2.11.1409020653100.42190@wonkity.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--4SFOXa2GPu3tIq4H Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 02, 2014 at 07:11:45AM -0600, Warren Block wrote: > On Mon, 1 Sep 2014, David Benfell wrote: >=20 > > 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"' >=20 > There is an extra single quote at the end of that line. Oops. An artifact from the configuration. I don't have the sorting hard-coded into the MDA. It works from a configuration file. The original idea was that I should be able to sort email based on the =66rom address or certain other addresses in the email headers. I do this with simple lists in text files. But sometimes I need to do something different--and I still don't want to hard code that into the program. Hence, grep. >=20 > > 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. >=20 > To see if the problem is with cron, I'd add a test cron job that just=20 > manually runs the test: >=20 > echo "Subject: Cron <benfell@home> /usr/local/bin/pycardsyncer" | /usr/bi= n/grep -q "^Subject: Cron" && echo "matched" >=20 > If that works, It did. > it's not a problem with cron or grep, and I'd proceed to=20 > do that same test but piping the actual test message in another cron=20 > job. This worked as well. That suggests it's my MDA that's broken, somehow, under cron but not =66rom the terminal. This is very bad news. And I haven't a clue why that might be. > Maybe also piping it to a file to see if it is being changed=20 > somehow in terms of whitespace or unescaped characters. >=20 > > 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. >=20 > I would still suspect underlying things. >=20 > Other thoughts: >=20 > If the MDA is Perl, why use grep? See above. Using grep is meant to be the exceptional case. Getting the program to allow for perl regular expressions would be an exercise I'm just not able to take on at the moment. > Also: > http://www.wonkity.com/~wblock/docs/html/maildrop.html Basically, maildrop and procmail are too hung up on solving problems with regular expressions. With the wildly disparate email addresses I'm dealing with--I receive newsletters from hundreds of news organizations--that would rapidly become unwieldy. To make them work, I'd have to resubscribe using the plus hack (assuming that even works). I'd rather my MDA just worked as it has for over a decade. > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o= rg" --=20 David Benfell <benfell@parts-unknown.org> See https://parts-unknown.org/node/2 if you don't understand the attachment. --4SFOXa2GPu3tIq4H Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJUBhkCAAoJEBV64x4SNmAroHIP/0aei7OEfXiR0D0dgC5I2hva MsYMhZaI2FioxVtWBKIL0M8/KD+sd0wiH6emLwD80LO3a1ZFo+4LdY/MYuY5L3BB 7VmRY7FLDjOGyqFZe0mjjtkPrs0U80a2fjWCKmeOZSkAcybcSE8VtgwewWduzlia vRf7BdNushZ7QRnfkpoIUNHhzr+zNt5m+2OIatTDu4kpkoZpXTxrFto6Sw2gF2PG OGdwTf5QjJ+HP1BVgIznKgfAV3EanRrmV5U5U0BtEFWxavA6kfbi8EOWlrn1yuOc YAFRFPpCV9KtmlyT+RxWse6ibLi1Y9/6tRT4fpalUW/jGLAPBBN1EZWrvV6KoY5K T9EGWDouj7EZnmcQsWYM1cXa1Yuoc3+BOth0a1glVQPZKNvHWufoGZfuc2SX8cai LQMz84JjCvrVZ6eaRBktokmBBoTh1fKnCqhVft5IGN52UNqOmhMb5faUqINNXJj6 p99BFGYjxbIO2IPTiB6kmvTuIniTrV1Z4r4yVdme1RdcKsuVm2emFtIuraal/9Rv z0H+k2MwX0h08oZd9Y3ghnxasU5Dx7FW7biSXqssc/QLsBGCdLSkPJ1+8+ueErif N3F0B0bJViFuAxWP4jEnAl4sbga6ajkxY7vcv0T4gBcxYhF13QU0p9rkq1HNG15N W8Gzy789Pc/R1MdIUhCi =viZY -----END PGP SIGNATURE----- --4SFOXa2GPu3tIq4H--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140902192242.GB34737>