Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply patch probably created with diff -r command?

Tags:

linux

diff

patch

Until now I created patches on Linux with this:

diff -rupN oldDir newDir > fix.patch

and applied them with this (from the oldDir):

patch -p1 < fix.patch

Now, I need to do a patch somebody else created and when I try this method, I get:

patch: **** Only garbage was found in the patch input.

I am not sure how this patch is generated (it has .diff extension). Partial content of patch file is: (just changed some file/folder names)

Only in ../oldDir: someFile1.a
diff -r ../oldDir/someFolder1/SomeFile3 ./someFolder1/SomeFile3
10c10
< #someContent1 
---
> #someContent1
Only in ../oldDir/someFolder1/someFolder2: someFile2.a
diff -r ../wfd_oldDir/someFolder1/someFolder2/someFile3 ./someFolder1/someFolder2/someFile3
2c2
< ##### Change the following for your environment: 
---
> ##### Change the following for your environment:
15,16c15,16
< LIBRARY_LINK =        ar cr 
< LIBRARY_LINK_OPTS =   
---
> LIBRARY_LINK =        ar cr
> LIBRARY_LINK_OPTS =
36c36
<   $(C_COMPILER) -c $(C_FLAGS) $<       
---
>   $(C_COMPILER) -c $(C_FLAGS) $<

....... (continue) .......

How can I apply this patch?

like image 381
kliketa Avatar asked Oct 21 '25 14:10

kliketa


1 Answers

Check for unix/windows line endings

like image 183
Edson Medina Avatar answered Oct 24 '25 06:10

Edson Medina



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!