Re: am fails to apply patches for files with CRLF lineendings
- From
Brandon Casey <drafnel@gmail.com>
- Date
- Dec 15, 2009, 03:59 UTC
- Message-ID
- <ee63ef30912141959g2da1bc65y20b9bdb93a2a8d41@mail.gmail.com>
- In-Reply-To
- <7vfx7d7zpp.fsf@alter.siamese.dyndns.org>
On Mon, Dec 14, 2009 at 8:12 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Brandon Casey <drafnel@gmail.com> writes: > >>> It actually is the norm to use LF as the line terminator in the body text >>> in saved messages (and trailing CR as a true part of the payload), and >>> "am" traditionally used that definition. It is meant to read from "mbox" >>> format to begin with. >> >> But isn't each email in the mbox file supposed to be RFC-2822 formatted >> anyway? > > If you are talking about the same "mbox" I was talking about, which is > what I see when I peek "/var/mail/junio", then the answer is no.
Yes, that is what I was talking about, but I did not know whether the individual mails which are separated by "From user@host ..." were supposed to be in RFC-2822 format or not.
> Their lines are terminated with a LF, and if you insert CR at the end of the > line it would appear as true payload.
How do you insert CR at the end of the line? Can you use mutt or something like it to send a mail which contains a CR? I have tried, and I have not been able to do so. I have tried mutt, mailx, and sendmail. For sendmail, I of course constructed the email headers by hand and piped it through sendmail. The CRLF in my tests were converted to LF by the time they reached /var/mail/casey.
Show 7 quoted lines
> DOSsy boxes can have C:\mail\user > or whatever that has DOS text, of course, so there is no "supposed to be". > > Having said that, it does not matter an iota in the real world if somebody > declares on _this list_ that it a bug that Thunderbird spits out CRLF text > in response to "Save As..." on platforms where LF is the natural line > terminator [*1*].
I'm not sure it is a bug, just a change in behavior.
> Whether it is a bug or not, we still need to help > people with such a program without breaking others.
I agree.
Show 5 quoted lines
> I saw "peeking the line ending of the first line" as suggested as a > solution, and my gut feeling, without thinking too much about it, is > that it is likely to be the right thing to do, especially if we do > both the check and the necessary conversion in either mailinfo or even > in mailsplit.
Yes, I think it will work as a work-around, unfortunately I cannot work on implementing this at the moment. I think the better solution, if it is not too costly, is to detect the presence of CR and produce a binary patch that can be sent through email and applied by git-am.
-brandon