procmail
[Top] [All Lists]

Re: how to handle case

2001-09-13 21:12:42
Rino has this code (as quoted by Philip; Rino's original article was in an
attachment, so I didn't read it),

:0
# line folded by me in quoting --DWT
* ^TO_\/(debian-user|ph-linux-newbie|plug|mutt-users|procmail|\
    ph-isp|ph-misc)@
* MATCH ?? ()\/[^(_at_)]+
$MAILDIR/$MATCH/

(BTW, $MAILDIR/ is implicit, and you don't need it unless you want the whole
path displayed in the Folder: entry of the log abstract.)

and thus this problem that goes with it:

| >it works fine as long as the list addresses are in lower case.  then
| >some windows user used an all caps "PH-ISP" and it blew my nicely
| >crafted maildir structure as i ended up with a "ph-isp" and "PH-ISP"
| >directories.

| >how can procmail be directed not to case-sensitive?

Extraction of MATCH will always pull out the text as it appears in the
message.  You're going to get the specific characters that appear instead of
a literal "[^(_at_)]+".  It's not a matter of case sensitivity in pattern
comparison and not a question of the `D' flag.  In truth, the problem is not
procmail's case sensitivity (which is off by default) at all but rather the
case sensitivity of file and directory names in your operating system [I
gather that that would be Linux].  If your OS considered "ph-isp" and
"PH-ISP" and "Ph-Isp" all as ways to address the same file or directory name
and not as different ones that could coexist in the same parent directory,
you wouldn't have this trouble.

Philip illustrated how to use a translation string (an idea I came up with
back in the day), but the root of the problem here is that you're trying to
identify mailing list distributions by the address to which they're sent.
That means that a post sent to as a blind carbon to the list's submission
address won't match your recipe for the list; it means that if you post and
somebody replies to you with a carbon to the list, your direct copy and your
copy as a list subscriber will both be filed in your folder for the list.
(You might not mind the latter, though I do, but certainly the former is an
undesirable effect.)

It is far better to identify mail from a list by some header that the list
software inserts or clobbers and not by anything under the poster's control.
The best choice will vary from list to list; List-ID is ideal if the list
uses it, but for various lists you may need to rely on Mailing-List:,
X-Mailing-List:, Sender:, or even 'From '.  The casing of the list's name
there will always be the same in every post, so if you extract it into
$MATCH you'll always get the same value, including the same casing.

And Rino, please post in straight text.  Wrapping things as attachments adds
bulk without adding content.


_______________________________________________
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>