Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This is the output of my patch command:

Hunk #11 merged at 4184,4190.
Hunk #12 merged at 4444.
Hunk #13 merged at 4944.
Hunk #14 NOT MERGED at 5106-5116.
Hunk #15 merged at 5290.
Hunk #16 merged at 5448.
patch unexpectedly ends in middle of line
Hunk #17 merged at 5608,5611.

The command was

patch -d ~/SOME_DIR -p1 --merge --verbose -u

The patch was produced using git:

git --git-dir ~/SOME_DIR/.git diff -U8 bb1ee538982957b421a4c0e78f30428e73c9a072 HEAD -- malloc.c

What does patch unexpectedly ends in middle of line mean, and is it a problem? Is it referring to hunk 16 or 17? What can I look for in the patch file to figure out what's causing this?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The message refers to Hunk 16.

This GitHub discussion is probably related to your issue.

It is about patch unexpectedly ends in middle of line messages because of CRLF (carriage-return, linefeed) issues when git generated diffs are used with patch.

To quote the conclusion:

[..] git can be very picky about line endings. Are you on windows or not? At any rate, you should probably set autocrlf in the git config. If you're on windows, you want "true", if you're on mac or linux, you should use "input" [..]

In the article Dealing with line endings GitHub details the above statement.

share|improve this answer
    
It should be noted, the questioner asked it this is bad - ending in the middle of a line is not a problem - just a warning. –  Ross Apr 10 at 16:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.