[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] message rewrite/fix up

From: Ralph Corderoy
Subject: Re: [Nmh-workers] message rewrite/fix up
Date: Sun, 10 Feb 2013 18:13:33 +0000

Hi David,

> messageid=`grep -i ^Message-Id "$1" | \
>     sed -e 's/^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]: *<*//' -e 's/>$//' | \
>     tr '[/\\]' '[..]'`

My inner sed prefers replacing those three with

    mi=`sed -n '
        /^$/q; /^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]:/!d
        s/>.*//; s/.*<//; y#/\\#..#; p
    ' "$1"`

:-)  It also avoids reading the whole of the email.  BTW, your brackets
for tr are actually asking it to transliterate an open bracket to an
open bracket and so on.

>  #      Message-IDs should be unique, so there should be no need to
>  #      backup a file with the same name, especially if it is
>  #      malicious.  If the backup file already exists, use 2).

Even if they are unique, and I've had incoming ones that aren't, they
could differ in a way that's removed by y#/#.#.  I wonder if the
fallback should be to use $mi as the base for whatever the POSIX way of
mktemp(1) is and let it avoid the clash.  That may, message-ID is still
the base.

Cheers, Ralph.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]