procmail
[Top] [All Lists]

Re: stumped on $MATCH problem

1997-01-05 14:11:05
Timothy Luoma asked how he could have a condition like,

| * ^Subject:.send-ftp-uuencoded *\/[^ ].*

but get these results, where "-uuencoded" ends up part of $MATCH:

| I send a message with this subject:
| 
| send-ftp-uuencoded /pub/next/submissions/README
| 
| ... I get the error message response:
| 
| Subject: File not found (-uuencoded /pub/next/submissions/README)
|
| ... but it works fine for other similar things, like:
| 
| * ^Subject:.send-ftp *\/[^ ].*

Cough.  Hack.  There it is.  Procmail sees that first, " *" matches on no
spaces, and everything from "-uuencoded " on goes into $MATCH.

Suggestions: put the routine for send-ftp-uuencoded before the routine
for send-ftp, or change the test for send-ftp to either of these:

  * ^Subject: *send-ftp *\/[^- ].*
or
  * !^Subject: *send-ftp-uuencoded
  * ^Subject: *send-ftp *\/[^ ].*

| I'm stumped....

A verbose logfile would have shown that the send-ftp routine, not the
send-ftp-uuencoded routine, was getting invoked here.  I recommend the
[^- ] method, because being careful of sequence or add "not like this
other command I implement" requires checking up and down your list every
time to make sure of every command name that is part of another command
name, but by making sure that $MATCH cannot start with a hyphen you'll
prevent that automatically without worrying about what you name your
commands (as long as two aren't named identically) -- except in the case
where the longer command name's extra characters start with a valid character
for the start of a filename; for example, if you have a send-pack command and
a send-package command.

My suggestion for a more general solution is to REQUIRE a space between
the command and the filename and change the conditions to this:

  * ^Subject: *commandname +\/[^ ].*

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