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

Re: [BUG PATCH RFC] mailinfo: correctly handle multiline 'Subject:' header

From
Kirill Smelkov <kirr@landau.phys.spbu.ru>
Date
Jan 7, 2009, 22:43 UTC
Message-ID
<20090107224342.GB4946@roro3>
In-Reply-To
<1230316721-14339-1-git-send-email-kirr@mns.spb.ru>
On Fri, Dec 26, 2008 at 09:38:41PM +0300, Kirill Smelkov wrote:
Show 7 quoted lines
> When native language (RU) is in use, subject header usually contains several
> parts, e.g.
> 
> Subject: [Navy-patches] [PATCH]
> 	=?utf-8?b?0JjQt9C80LXQvdGR0L0g0YHQv9C40YHQvtC6INC/0LA=?=
> 	=?utf-8?b?0LrQtdGC0L7QsiDQvdC10L7QsdGF0L7QtNC40LzRi9GFINC00LvRjyA=?=
> 	=?utf-8?b?0YHQsdC+0YDQutC4?=
Which btw should be extracted by git-mailinfo to:
    'Subject: Изменён список пакетов необходимых для сборки'
Show 36 quoted lines
> This exposes several bugs in builtin-mailinfo.c that I try to fix:
> 
> 
> 1. decode_b_segment: do not append explicit NUL -- explicit NUL was preventing
>    correct header construction on parts concatenation via strbuf_addbuf in
>    decode_header_bq. Fixes:
> 
> -Subject: Изменён список пакетов необходимых для сборки
> +Subject: Изменён список па
> 
> 
> Then
> 
> 2. (hackish) do not emit '\n' after processing of every header segment. It
>    seems we should emit previous part as-is only if it does not end with
>    '=?='. Fixes:
> 
> -Subject: Изменён список пакетов необходимых для сборки
> +Subject: Изменён список па кетов необходимых для сборки
> 
> 
> Sorry for low-quality patch and description. I did what I could and don't have
> energy and time dig more into MIME.
> 
> Please help.
> 
> Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
> 
> ---
>  builtin-mailinfo.c  |   18 ++++++++++++++++-
>  t/t5100-mailinfo.sh |    2 +-
>  t/t5100/info0012    |    5 ++++
>  t/t5100/msg0012     |    7 ++++++
>  t/t5100/patch0012   |   30 +++++++++++++++++++++++++++++
>  t/t5100/sample.mbox |   52 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 112 insertions(+), 2 deletions(-)
Junio, All,
What about this patch?

It at least exposes bug in git-mailinfo wrt handling of multiline subjects, and in very details documents it and adds a test for it.

Yes, my fixes are of 'low quality', but may I try to attract git community attention one more time?

Thanks beforehand, Kirill

P.S. original post with patch:
http://marc.info/?l=git&m=123031899307286&w=2
Previous: Kirill SmelkovNext: Junio C Hamano
Message 2 of 12 in “mailinfo: correctly handle multiline 'Subject:' header”
  1. mailinfo: correctly handle multiline 'Subject:' headerKirill Smelkov, Dec 26, 2008
  2. Kirill SmelkovJan 7, 2009
  3. Junio C HamanoJan 8, 2009
  4. Junio C HamanoJan 8, 2009
  5. Alexander PotashevJan 8, 2009
  6. Kirill SmelkovJan 8, 2009
  7. Kirill SmelkovJan 10, 2009
  8. Junio C HamanoJan 11, 2009
  9. Kirill SmelkovJan 12, 2009
  10. Junio C HamanoJan 12, 2009
  11. Kirill SmelkovJan 13, 2009
  12. Kirill SmelkovJan 14, 2009

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.