Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file Makefile.am.rej
The same error I found when I apply changes through the patch and then searched completely on StackOverflow but I didn't get the answer.
Then I searched small parts
like the reason behind the patch error then I found that
Hunk #n FAILED at nnn. n out of n hunks FAILED - saving rejects to file file.rej
This means that one or more changes, called hunks, could not be introduced into the file. Occasionally this could be because the patch was emailed or copied into a file and whitespace was either added or removed. Try adding --ignore-whitespace to the command line to work around this.
Step 2
then I searched about the different ends of the file, I found that there are two types of format systems LF, CF
then I check my files in what format by using
Now if this file was made in *NIX systems, it would display
$ cat -A file
hello$
hello$
But if this file was made in Windows, it would display
$ cat -A file
hello^M$
hello^M
represents CR and $ represents LF. Notice that Windows did not save the last line with CRLF
this I found from StackOverflow
then I check my original file format and .patch/diff I get that the patch file has both LF and Cf
then I convert these files before applying the patch to either windows or unix format by using
dos2unix filename.extension or unix2dos filename.extension
this converts file
then apply the patch to get the result
command promt commands
creating file
touch filename.txt
for creating a patch/ diff file
diff -u originalfile.txt editedfile.txt > originalfile.diff
or
diff -u originalfile.txt editedfile.txt > originalfile.patch
before applying change check file formats
cat -A originalfile.txt
cat -A originalfile.diff
now converts doc2unix or unix2dos
unix2dos originalfile.txt
unix2dos originalfile.diff
apply changes
patch originalfile.txt < originalfile.diff
Done !!
I hope this will help you !