[development] Patches on OS X

Ken Rickard agentrickard at gmail.com
Sat Apr 14 14:00:18 UTC 2007


All-

I'm trying to troubleshoot an issue that came up when working on
http://drupal.org/node/118660.

I run OS X (10.4) and roll patches using 'cvs diff -up > file.patch' on the
command line.  This uses the Darwinports version of cvs.

As near as I can figure, differences in how Macs handle linebreaks (/n vs.
/r) cause problems, as running the patch will generate the error:

"patch unexpectedly ends in middle of line"

See http://drupal.org/node/122734 for another example.

A Google search reveals 84 reported instances of this type error on
drupal.org, so I'd like to add some handbook notes about it, but can't
figure the solution.  It seems to be quite common (there are over 400,000
matches on google), but no one ever reports a solution.

The closest I've seen is dreweish's note at
http://drupal.org/node/35945#comment-217838, which suggests running a
linebreak converter before applying a patch.  But this doesn't seem to help
me in rolling and submitting a patch.

Unless the answer is to run a linebreak converter on the patch after its
rolled and before I submit it.  But opening the patchfile in BBEdit
indicates that the file has Unix line ends.

I can even see in the Darwinports release where this error comes from. (
http://www.opensource.apple.com/darwinsource/Current/patch_cmds-10/patch/pch.c).
But no instructions for how to handle it.

Offlist answers are fine.  I intend to write a handbook note with the
answers.

Ref:

http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=UeN&q=site%3Adrupal.org+patch+unexpectedly+ends+in+middle+of+line&btnG=Search

http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=6Ji&q=patch+unexpectedly+ends+in+middle+of+line&btnG=Search

-- Ken Rickard
agentrickard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070414/49d6fb38/attachment.htm 


More information about the development mailing list