Game Development Community

Applying Patch Files

by Gurpreet Nijjar · in General Discussion · 03/14/2007 (11:06 pm) · 3 replies

Well i have a little problem here, I have compiled the engine before but im starting to deal with patch files and to not wish to go line by line on a 5000 line script. I have tried 3 different patches with the same problem making me believe im doing something incorrect.
1) i have the UnxUtils.zip
2) i take the patch file and locate it to my Torque directory, F:\Torque\RTSStarterKit\envTorque-135.patch
3) go to prompt and type in C:\unx\usr\local\wbin>patch -p0 < f:\Torque\RTSStarterKit\envTorque-135.patch

and my results are always the same even if i do a -force. Heres a small snip-it from the console below, all results for each check are the same and it skips each change. I have even double checked the + and - line location numbers and they are all accurate but for some reason it says its not!

--------------------------
|Index: terrain/sun.h
|===================================================================
|RCS file: /export/home/peters34/cvs-main/engine/terrain/sun.h,v
|retrieving revision 1.1.1.1
|diff -u -r1.1.1.1 sun.h
|--- terrain/sun.h 2 Oct 2005 20:37:03 -0000 1.1.1.1
|+++ terrain/sun.h 2 Oct 2005 21:53:50 -0000
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
Hunk #1 ignored at 31.
1 out of 1 hunk ignored
Hmm... The next patch looks like a unified diff to me...
can't find file to patch at input line 5230
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: terrain/terrRender.cc
|===================================================================
|RCS file: /export/home/peters34/cvs-main/engine/terrain/terrRender.cc,v
|retrieving revision 1.1.1.1
|diff -u -r1.1.1.1 terrRender.cc
|--- terrain/terrRender.cc 2 Oct 2005 20:37:03 -0000 1.1.1.1
|+++ terrain/terrRender.cc 2 Oct 2005 21:53:50 -0000
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
Hunk #1 ignored at 5.
Hunk #2 ignored at 1765.
Hunk #3 ignored at 2161.
3 out of 3 hunks ignored
Hmm... The next patch looks like a unified diff to me...
can't find file to patch at input line 5305
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: terrain/waterBlock.cc
|===================================================================
|RCS file: /export/home/peters34/cvs-main/engine/terrain/waterBlock.cc,v
|retrieving revision 1.1.1.1
|diff -u -r1.1.1.1 waterBlock.cc
|--- terrain/waterBlock.cc 2 Oct 2005 20:37:03 -0000 1.1.1.1
|+++ terrain/waterBlock.cc 2 Oct 2005 21:53:50 -0000
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
Hunk #1 ignored at 59.
1 out of 1 hunk ignored
Hmm... The next patch looks like a unified diff to me...
can't find file to patch at input line 5321
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: ts/tsMesh.cc
|===================================================================
|RCS file: /export/home/peters34/cvs-main/engine/ts/tsMesh.cc,v
|retrieving revision 1.1.1.1
|diff -u -r1.1.1.1 tsMesh.cc
|--- ts/tsMesh.cc 2 Oct 2005 20:37:03 -0000 1.1.1.1
|+++ ts/tsMesh.cc 2 Oct 2005 21:53:50 -0000
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
Hunk #1 ignored at 17.
Hunk #2 ignored at 794.
2 out of 2 hunks ignored
done

#1
03/14/2007 (11:29 pm)
You could possibly be running into an issue where there are no "new lines" in the file -- UNIX and Windows treat these differently ... unix using \n and windows using \r\n ... try using a DOS to UNIX converter on the files, and trying again ... however, I don't really see this being the problem ... unless the patch file was based on UNIX line feeds ... which is a high probability since it's a "patch" file ;)

Just a thought ... could be way off though ...
#2
03/15/2007 (8:32 am)
Well, i tried that and it still doesnt work, anybody else got some ideas....
#3
03/16/2007 (9:46 am)
Quote:3) go to prompt and type in C:\unx\usr\local\wbin>patch -p0 < f:\Torque\RTSStarterKit\envTorque-135.patch

correct me if I am wrong.
but you are executing patch from where?

from c:\unx\usr\local\wbin\ ?

that is wrong.
add the ../wbin/ to your environment path.
and when you run patch
you have to be in the folder where the patch is destined.

I was wrong once before tho.
I was mistaken.