How to apply *.patch

waffull
waffull's picture

Joined: 2002-09-07
Posts: 115
Posted: Sat, 2002-09-07 22:22

Details:
Gallery v1.3.2-cvs-b4
Win 2k Server w/SP2
Apache 1.3.24
PHP 4.2.0

How do I apply the patch files that are available in the add ons section?
Specifically the high-move patch?

Thank you,
Marc

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Sun, 2002-09-08 05:54

Go to your Gallery installation /path/to/gallery/
From inside that directory do: patch -p1 < /path/to/file.patch

Most patches are made to be used with -p1, some, however, need -p0

Btw, nice to see someone interested in my work :wink:

 
waffull
waffull's picture

Joined: 2002-09-07
Posts: 115
Posted: Sun, 2002-09-08 15:45

I thank you for your reply, but unless I am missing something, there is no executable file called patch in the Win32 gallery installation.

Sorry for being a pain, I'm just getting frustrated :roll:

Thank you!!!

Marc

 
h0bbel
h0bbel's picture

Joined: 2002-07-28
Posts: 13451
Posted: Sun, 2002-09-08 17:43
Quote:
I thank you for your reply, but unless I am missing something, there is no executable file called patch in the Win32 gallery installation.

Sorry for being a pain, I'm just getting frustrated :roll:

Thank you!!!

Marc

Try the Win32 GNU Patch, available <!-- BBCode Start --><A HREF="http://users.ncrvnet.nl/gmvdijk/utilities.html#PATCH" TARGET="_blank">here</A><!-- BBCode End -->! :smile:

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Sun, 2002-09-08 19:39

Sorry about that, I totally missed the bit where you said you
were on windows. Go with what H0bbel said :razz:

 
waffull
waffull's picture

Joined: 2002-09-07
Posts: 115
Posted: Mon, 2002-09-09 21:16

h0bbel, thanks for the info.. but....

The link to the file from the site that h0bbel has didn't work. I was finally able to find the file from: http://www.fsci.fuk.kindai.ac.jp/kakuto/soft.html (It seems to have the english version on there.)

Anyway, when I ran it, I got numerous errors, with both the -p1 and -p0. Have you been able to get this patch to work on a win32 box? I will spend the time sending you all the error messages if you think it should work. But there were A LOT of missing lines and files (based on the errors i got..

Thank you,
Marc

PS: Here is the error message when using -p1 (when using -p0 the errors go on and on, way more than my buffer. I will have to increase that to get you the details..)

F:apachehtdocsgallery>patch -p1 < gallery-1.3-high-move.patch
patching file `classes/Image.php'
Assertion failed: hunk, file patch.c, line 321

abnormal program termination

 
h0bbel
h0bbel's picture

Joined: 2002-07-28
Posts: 13451
Posted: Mon, 2002-09-09 22:11

I'm sorry, but i just did a quick Google search and found the utility there. Too bad it didn't work out, but i'm sure there is a win32 patch util out there that will do the trick. I'll keep searching, and se what I come up with.

(a couple of minutes later...)

Found <!-- BBCode Start --><A HREF="http://www.nightmare.com/squirl/win32/patch_win32.zip" TARGET="_blank">this</A><!-- BBCode End -->. In the readme it states:

Quick port of patch.

Got the sources from:
ftp://gatekeeper.dec.com/pub/BSD/FreeBSD/FreeBSD-current/src/gnu/usr.bin/patch/

I used MS VC++ v4.2.

-Sam

---snipp--

seems to be a port of the freebsd patch util - it might work....

:roll:

 
h0bbel
h0bbel's picture

Joined: 2002-07-28
Posts: 13451
Posted: Mon, 2002-09-09 22:11

Double post... fun....

Anyhow, i also found the Gnuwin32 port <!-- BBCode Start --><A HREF="http://gnuwin32.sourceforge.net/packages/patch.htm" TARGET="_blank">here</A><!-- BBCode End --> - might be worthwile checking out.

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Tue, 2002-09-10 02:53

Well, that assertion was from the patch command itself, not
from my patch. There is not file named patch.c in the patch itself
and it certainly isn't 300 lines long :wink:

I don't think you can redirect the same under windows, think I saw
that mentioned somewhere when I took a quick look.

Try just running: patch -p1 file.patch
Check whatever documention comes with the file on how to properly
execute it.

 
waffull
waffull's picture

Joined: 2002-09-07
Posts: 115
Posted: Tue, 2002-09-10 03:26

Ok... A few things...
1) Thank you guys for all your help. I really do appreciate it!!!
2) I do not have MS VC++ (any version). I could probably get it, but it would take me a while.
3) I tried running it without the redirect, and the command seems to do nothing. It just sits there as if it is waiting for sometype of input.
4) I downloaded the patch from: http://www.nightmare.com/squirl/win32/patch_win32.zip
-----I get the same error message as I posted before (when using -p1)
5) When using -p0 I get this: It would be MUCH MUCH MUCH longer, but my dos window buffer won't hold more than 999. (I hope this might be of some use to you.)

F:apachehtdocsgallery>patch -p0 < gallery-1.3-high-move.patch
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urw gallery/classes/Image.php Gallery/classes/Image.php
|--- gallery/classes/Image.php 2002-05-27 13:33:03.000000000 -0400
|+++ Gallery/classes/Image.php 2002-08-14 11:30:22.000000000 -0400
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 17
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|lery/do_command.php Gallery/do_command.php
|--- gallery/do_command.php 2002-05-27 13:33:00.000000000 -0400
|+++ Gallery/do_command.php 2002-08-08 00:15:33.000000000 -0400
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 34
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|/move_photo.php Gallery/move_photo.php
|--- gallery/move_photo.php 2002-05-27 13:33:01.000000000 -0400
|+++ Gallery/move_photo.php 2002-08-14 03:00:15.000000000 -0400
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
missing header for unified diff at line 60 of patch
can't find file to patch at input line 60
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|214,8 @@
| <input type=submit value="Move it!">
| <input type=submit name="submit" value="Cancel" onclick='parent.close()'>
| </form>
|-<p>
|-<hr size=1>
|-<b>OR</b>
|-<hr size=1>
|-
|-
|-
|
|-<?
|+<? } else if ($relocate) {
| if ($gallery->album->isAlbumName($index)) {
| ?>
| Move the album to a new album:<br>
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 99
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|>
| <?
| } // end else
|+} // end relocate
|+if ($relocate) {
| ?>
|+
| <br>
| <input type=submit value="Move to Album!">
| <input type=submit name="submit" value="Cancel" onclick='parent.close()'>
| </form>
|+
| <?
|+} // end relocate
| }
| } else {
| error("no album / index specified");
| }
| ?>
|-</font>
|
| <script language="javascript1.2">
| <!--
|diff -urw gallery/rename_album.php Gallery/rename_album.php
|--- gallery/rename_album.php 2002-05-27 13:33:01.000000000 -0400
|+++ Gallery/rename_album.php 2002-08-15 10:06:20.000000000 -0400
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
missing header for unified diff at line 114 of patch
can't find file to patch at input line 114
Perhaps you used the wrong -p or --strip option?
File to patch:
Skip this patch? [y]
Skipping patch.
missing header for unified diff at line 119 of patch
can't find file to patch at input line 119
Perhaps you used the wrong -p or --strip option?
File to patch:
Skip this patch? [y]
Skipping patch.
missing header for unified diff at line 124 of patch
can't find file to patch at input line 124
Perhaps you used the wrong -p or --strip option?
File to patch:
Skip this patch? [y]
Skipping patch.
missing header for unified diff at line 129 of patch
can't find file to patch at input line 129
Perhaps you used the wrong -p or --strip option?
File to patch:
Skip this patch? [y]
Skipping patch.
missing header for unified diff at line 134 of patch
can't find file to patch at input line 134
Perhaps you used the wrong -p or --strip option?
File to patch:
Skip this patch? [y]
Skipping patch.
missing header for unified diff at line 139 of patch
can't find file to patch at input line 139
Perhaps you used the wrong -p or --strip option?
File to patch:
Skip this patch? [y]
Skipping patch.
missing header for unified diff at line 144 of patch
can't find file to patch at input line 144
Perhaps you used the wrong -p or --strip option?
File to patch:
Skip this patch? [y]
Skipping patch.
missing header for unified diff at line 149 of patch
can't find file to patch at input line 149
Perhaps you used the wrong -p or --strip option?
File to patch:
Skip this patch? [y]
Skipping patch.
missing header for unified diff at line 154 of patch
can't find file to patch at input line 154
Perhaps you used the wrong -p or --strip option?
File to patch:
Skip this patch? [y]
Skipping patch.
missing header for unified diff at line 159 of patch
can't find file to patch at input line 159
Perhaps you used the wrong -p or --strip option?
File to patch:
Skip this patch? [y]
Skipping patch.
missing header for unified diff at line 164 of patch
can't find file to patch at input line 164
Perhaps you used the wrong -p or --strip option?
(At this point I hit ctrl-C to get out of it. It would have gone on for 100's of more lines.)

I read through the documentation and it really isn't much help. All the installation instructions seem to be for unix/linux boxes. Plus, I assume since they are coming with a patch.exe file, it is already compiled for the win32 platform. I'm really know VERY little about programming, so I appologize if I am asking to many questions..

Thank you again for your help..
Marc

 
srufle

Joined: 2008-12-15
Posts: 1
Posted: Mon, 2008-12-15 18:57

I also received this "file patch.c, line 321" error when trying to use a patch from svn diff and then trying to apply the patch using patch.exe from http://gnuwin32.sourceforge.net/

The output of diff in svn and maybe other applications put unix line endings into the patch files. I was able to fix the above error by running my patch files through unix2dos -D *.patch. If you do not have that I was also able to switch line endings in Jedit.

YMMV