Marco Stornelli <> writes:

> I tried the Johannes's script, but it seems it doesn't work well with
> the pattern of format-patch (To: <mail1>,\n   <mail2>,\n
> <mailN>). The multilines are not well managed.

I am guessing that the reason why Jonahhes's "copy our headers out
with continuation lines intact" approach does not work is because
Thunderbird does not want to see its own header part (i.e. that
which comes before that $SEP) contain RFC-2822 style continuation

Can you grab a typical input (i.e. the contents of what is passed as
$1 to the script) and show us how it looks like here so that
we can take a look?  It would be fine to paste the contents, but we
might want to protect it from MUA by doing an attachment or a
pastebin URL.

It appears that the original script tries very hard to keep the
Subject: line at the beginning, but I am not sure if that is because
Thunderbird wants to read its "$1" that way, or it is just that
original script happened to be written that way without real
reason.  If I were updating this script, what I would do would be
more like:

    0. Open a temporary output file $OUT, input filehandle $IN from
       ${PATCH}, and another input filehandle $TEMPLATE from "$1"

    1. Read from $IN starting from the second line (i.e. skip the
       first line "From [0-9a-f] Mon Sep 17 00:00:00 2001" magic
       marker) upto the empty line, coalescing the RFC-2822 style
       continuation lines into one long line each.

    2. Output the above into $OUT, while applying your "header field
       name translation" (e.g. "Oggetto") and remembering what
       header you wrote out.

    3. Read from $TEMPLATE up to a line that matches the following


       reject headers that step 2. already emitted, and emit other
       headers to $OUT.  Also emit that line that matched the above
       SEP pattern to $OUT (by doing so, you do not have to care how
       "Don't remove this line" is spelled in the user's language).

    4. Resume reading from $IN and copy to $OUT, including the patch
       separator "---", and stop copying.

    5. Read the remainder of $TEMPLATE and copy to $OUT.

    6. Read the remainder of $IN and copy to $OUT.

    7. Rename the temporary file that was connected to $OUT to "$1".

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to