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

Re: [PATCH] Let mailsplit and mailinfo handle mails with CRLF line-endings

From
Alex Riesen <raa.lkml@gmail.com>
Date
Aug 4, 2009, 20:57 UTC
Message-ID
<81b0412b0908041357he6056a3l78ebcec413a2e255@mail.gmail.com>
In-Reply-To
<fabb9a1e0908041034y1a43fdf6nae14ec106a82f00c@mail.gmail.com>
On Tue, Aug 4, 2009 at 19:34, Sverre Rabbelier<srabbelier@gmail.com> wrote:
Show 13 quoted lines
> On Tue, Aug 4, 2009 at 10:26, Alex Riesen<raa.lkml@gmail.com> wrote:
>>        }
>> +       if (len > 1 && buf[len - 2] == '\r')
>> +               buf[--len - 1] = '\n';
>>        buf[len] = '\0';
>
> How about something like:
>
> +       if (len > 1 && buf[len - 2] == '\r' && (buf[len - 1] == '\n'
> || buf[len - 1] == '\0'))
> +               buf[--len - 1] = '\n';
>
> To make sure that we're not erasing a \r somewhere in the middle of the content?
I think this should be enough:
	if (c == '\n' && len > 1 && buf[len - 2] == '\r')
		buf[--len - 1] = '\n';
I'll resend.
Previous: Brandon CaseyNext: Alex Riesen
Message 14 of 33 in “Please make git-am handle \r\n-damaged patches”
  1. H. Peter AnvinAug 3, 2009
  2. Junio C HamanoAug 3, 2009
  3. Wesley J. LandakerAug 3, 2009
  4. H. Peter AnvinAug 3, 2009
  5. H. Peter AnvinAug 3, 2009
  6. Sverre RabbelierAug 3, 2009
  7. H. Peter AnvinAug 3, 2009
  8. Paolo BonziniAug 4, 2009
  9. Alex RiesenAug 4, 2009
  10. Junio C HamanoAug 4, 2009
  11. Let mailsplit and mailinfo handle mails with CRLF line-endingsAlex Riesen, Aug 4, 2009
  12. Sverre RabbelierAug 4, 2009
  13. Brandon CaseyAug 4, 2009
  14. Alex RiesenAug 4, 2009
  15. Let mailsplit and mailinfo handle mails with CRLF line-endingsAlex Riesen, Aug 4, 2009
  16. Brandon CaseyAug 4, 2009
  17. Brandon CaseyAug 4, 2009
  18. Alex RiesenAug 4, 2009
  19. Alex RiesenAug 4, 2009
  20. Alex RiesenAug 4, 2009
  21. Brandon CaseyAug 4, 2009
  22. Erik Faye-LundAug 4, 2009
  23. Alex RiesenAug 4, 2009
  24. Erik Faye-LundAug 4, 2009
  25. Tony FinchAug 5, 2009
  26. Nanako ShiraishiAug 4, 2009
  27. Junio C HamanoAug 4, 2009
  28. 0/4 Re: Please make git-am handle \r\n-damaged patchesBrandon Casey, Aug 5, 2009
  29. 1/4 strbuf: add new function strbuf_getwholeline()Brandon Casey, Aug 5, 2009
  30. 2/4 builtin-mailinfo,builtin-mailsplit: use strbufsBrandon Casey, Aug 5, 2009
  31. 3/4 builtin-mailsplit.c: remove read_line_with_nul() since it is no longer usedBrandon Casey, Aug 5, 2009
  32. 4/4 Allow mailsplit (and hence git-am) to handle mails with CRLF line-endingsBrandon Casey, Aug 5, 2009
  33. Alex RiesenAug 5, 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.