git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4] Thunderbird: fix appp.sh format problems

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 3, 2012, 20:16 UTC
Message-ID
<7voblmeua3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<5044D162.1010608@gmail.com>
Marco Stornelli <marco.stornelli@gmail.com> 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 lines.

Can you grab a typical input (i.e. the contents of what is passed as $1 to the appp.sh 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 appp.sh 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
       pattern:
	/^-=-=-=-=-=-=-=-=-=#.*#=-=-=-=-=-=-=-=-=-$/
       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".
       
Previous: Marco StornelliNext: Marco Stornelli
Message 13 of 21 in “Thunderbird: fix appp.sh format problems”
  1. Thunderbird: fix appp.sh format problemsMarco Stornelli, Aug 31, 2012
  2. Junio C HamanoAug 31, 2012
  3. Marco StornelliSep 1, 2012
  4. Junio C HamanoSep 2, 2012
  5. Junio C HamanoAug 31, 2012
  6. Johannes SixtAug 31, 2012
  7. Marco StornelliSep 1, 2012
  8. Johannes SixtSep 1, 2012
  9. Marco StornelliSep 1, 2012
  10. Junio C HamanoSep 2, 2012
  11. Marco StornelliSep 3, 2012
  12. Marco StornelliSep 3, 2012
  13. Junio C HamanoSep 3, 2012
  14. Marco StornelliSep 4, 2012
  15. Junio C HamanoSep 4, 2012
  16. Marco StornelliSep 4, 2012
  17. Junio C HamanoSep 4, 2012
  18. Marco StornelliSep 4, 2012
  19. Junio C HamanoSep 4, 2012
  20. Marco StornelliSep 5, 2012
  21. Junio C HamanoSep 2, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.