"Malformed patch" error while applying the diff to wget source with patch

This is a common problem with diffs copied/pasted into a text file without space indentation. You need to add space in front of each line, except for lines beginning with the symbols "+", "-" and "@@".  To avoid this problem, it is better to generate the diff files yourself by hand (using diff or a version control diff tool) and then download the diff file as whole, instead of copying and pasting from your browser.

I would suggest that before applying the patch, you check if the patch has made it upstream, and is available in newer/latest/stable release, which would solve your problem in a clean way. Even if you patch the .c file, you are going to compile it anyway, so why not do it with a fresh stable tarball, if the patch has made into upstream.


I second Nikhils general comments. However, I'll just point out that you are in general better off downloading the html file and then converting it to text, rather than using cut and paste. For example, you can do

1) wget -c http://osdir.com/ml/web.wget.patches/2007-07/msg00011.html

2) Open msg00011.html with Openoffice, for example. and save as text. The OO converter does a good job, and I didn't see any obvious problems with the converted patches.

Tags:

Wget

Patch