procmail
[Top] [All Lists]

Regexp fails in scoring recipe

2003-04-29 17:07:14
I have a recipe that filters traffic reports delivered to me in the afternoon one hour intervals. I only want to see reports with accidents, slowdowns, and traffic advisories in locations along my commute, and not those with only scheduled road work. The recipe deletes reports that don't contain locations along my commute as well as reports about road work in those cities unless there are accidents, slowdowns, advisories in those cities. This recipe use to work until mid-April. Then it started failing and it would deliver reports with only road work in those cities instead of deleting them. The weird thing is that the recipe works when I subsequently debug the problem in a test directory on my IMAP/file server after erroneous delivery.

Does anyone know why procmail behaves inconsistently between production mode and test mode (see the diagnostic output below)? The IMAP server may have recently had a sendmail patch applied, but I don't know if that is related in any way. The platform is procmail 3.15.2 on Solaris 9.

The scoring recipe, part of a sample traffic report, and the diagnostic outputs in production mode (incorrect) and debug mode (correct) are included below.

Kevin


The recipe:
----------
LOCATIONS="(dumbarton|(east )?palo alto|stanford|menlo park|\\
         redwood city|mountain view)"
:0
* ^From:.*(\<)KPIX\.Traffic\.Router
{
 # Delete the traffic report if it has no incidents in our
 # commute region.
 #
 :0 B
 * $ ! (\<)$LOCATIONS\>
 /dev/null

 # Debug traffic report filtering.
 #
 :0
 * DEBUG ?? 0
 {
   VERBOSE=YES
   LOGFILE=$MYLOGFILE
 }

 # Delete the traffic report if the only references to nearby
 # locations are for recurring events.
 #
 :0 B
 *  1^0
 *  1^1 $ (\<)(road work((^.*)$LOCATIONS))\>
 *  1^1 $ (\<)(road work((^.*)[a-z]+.*)((^.*)$LOCATIONS))\>
 *  1^1 $ (\<)(road work((^.*)[a-z]+.*)((^.*)[a-z]+.*)((^.*)$LOCATIONS))\>
 * -1^1 $ (^.*)$LOCATIONS\>
 /dev/null

 # Debug failure to delete road-work-only traffic reports. When
 # deletion is working, we should not reach this point when the
 # score is positive because the report should have been delivered
 # to /dev/null.
 #
 LAST="$="
 :0 fhwi
 | formail -I"X-Traffic-Score: $LAST"

 :0
 * DEBUG ?? 0
 {
   VERBOSE=NO
 }
}


Part of the traffic report message body:
---------------------------------------
[ 5:24 AM]  181502   ROAD WORK
OAKLAND : EB 24 AT THE CALDECOTT TUNNEL ... ROADWORK IN VARIOUS LANES FROM
9:30PM TO 5AM (1057) -- (CALTRANS)

[ 5:26 AM]  191505   ROAD WORK
MENLO PARK : EB 84 BETWEEN MARSH RD AND UNIVERSITY AV ... ROADWORK IN THE LEFT
LANE FROM 11PM TO 5AM (3672) -- (CALTRANS)

[ 5:25 AM]  201505   ROAD WORK
MENLO PARK : WB 84 BETWEEN UNIVERSITY AV AND MARSH RD ... ROADWORK IN THE LEFT
LANE FROM MIDNIGHT TO 5AM (3674) -- (CALTRANS)

[ 5:25 AM]  211505   ROAD WORK
BURLINGAME : IN BOTH DIRECTIONS EL CAMINO REAL BETWEEN MURCHISON DR AND ARROYO
DR ... IN SOUTH SAN FRANCISCO .. ROADWORK IN VARIOUS LANES, SCHEDULED UNTIL
6AM (3483/3484) -- (CALTRANS)

[ 5:25 AM]  221504   ROAD WORK
SAN JOSE : SB 880 BETWEEN BROKAW RD AND OLD BAYSHORE HWY ... ROADWORK IN
VARIOUS LANES FROM MIDNIGHT TO 5AM (3623) -- (CALTRANS)

[ 5:26 AM]  231506   ROAD WORK
SAN RAFAEL : SB 101 BETWEEN 580 AND SIR FRANCIS DRAKE BLVD ... ROADWORK IN
VARIOUS LANES FROM 8PM TO 5AM (2508) -- (CALTRANS)

[ 5:23 AM]  241501   ROAD WORK
DUMBARTON BRIDGE : WB 84 BETWEEN THE WEST END OF THE BRIDGE AND UNIVERSITY AVE
... ROADWORK IN VARIOUS LANES FROM 7PM TO 5AM (3665)


The log file output in production mode (incorrect):
--------------------------------------------------
procmail: Score:       1       1 ""
procmail: Score:       0       1 "(\<)(road work((^.*)(dumbarton|(east
)?palo alto|stanford|menlo park|redwood city|mountain view)))\>"
procmail: Score:       0       1 "(\<)(road
work((^.*)[a-z]+.*)((^.*)(dumbarton|(east )?palo alto|stanford|menlo
park|redwood city|mountain view)))\>"
procmail: Score:       0       1 "(\<)(road
work((^.*)[a-z]+.*)((^.*)[a-z]+.*)((^.*)(dumbarton|(east )?palo
alto|stanford|menlo park|redwood city|mountain view)))\>"
procmail: Score:      -3      -2 "(^.*)(dumbarton|(east )?palo
alto|stanford|menlo park|redwood city|mountain view)\>"
procmail: Assigning "LAST=-2"
procmail: Executing "formail,-IX-Traffic-Score: -2"


The post-delivery diagnostic output on my IMAP/file server (correct):
--------------------------------------------------------------------
procmail: Score:       1       1 ""
procmail: Score:       3       4 "(\<)(road work((^.*)(dumbarton|(east
)?palo alto|stanford|menlo park|redwood city|mountain view)))\>"
procmail: Score:       0       4 "(\<)(road
work((^.*)[a-z]+.*)((^.*)(dumbarton|(east )?palo alto|stanford|menlo
park|redwood city|mountain view)))\>"
procmail: Score:       0       4 "(\<)(road
work((^.*)[a-z]+.*)((^.*)[a-z]+.*)((^.*)(dumbarton|(east )?palo
alto|stanford|menlo park|redwood city|mountain view)))\>"
procmail: Score:      -3       1 "(^.*)(dumbarton|(east )?palo
alto|stanford|menlo park|redwood city|mountain view)\>"
procmail: Assigning "LASTFOLDER=/dev/null"
procmail: Opening "/dev/null"







_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>