Jump to content

Applying diff files to source code?


VaKo

Recommended Posts

http://www.freebsd.org/cgi/query-pr.cgi?pr...1&cat=ports

Trying to patch proFTPd using a diff file, as the current code in the ports is broken. So far I've had a bit of a google and tried "patch < patch-1.diff", "patch -i patch-1.diff", but keep getting :

[root@echo /usr/ports/ftp/proftpd]# patch -p1 &lt; patch-1.diff

Hmm...  Looks like a unified diff to me...

The text leading up to this was:

--------------------------

|diff -ruN --exclude=CVS /usr/ports/ftp/proftpd.orig/Makefile /usr/ports/ftp/proftpd/Makefile

|--- /usr/ports/ftp/proftpd.orig/Makefile Tue Dec 26 11:12:52 2006

|+++ /usr/ports/ftp/proftpd/Makefile      Tue Dec 26 12:00:33 2006

--------------------------

File to patch: Makefile

Patching file Makefile using Plan A...

patch: **** malformed patch at line 11: @@ -140,7 +141,7 @@

and

[root@echo /usr/ports/ftp/proftpd]# patch -i patch-1.diff

Hmm...  Looks like a unified diff to me...

The text leading up to this was:

--------------------------

|diff -ruN --exclude=CVS /usr/ports/ftp/proftpd.orig/Makefile /usr/ports/ftp/proftpd/Makefile

|--- /usr/ports/ftp/proftpd.orig/Makefile Tue Dec 26 11:12:52 2006

|+++ /usr/ports/ftp/proftpd/Makefile      Tue Dec 26 12:00:33 2006

--------------------------

Patching file Makefile using Plan A...

patch: **** malformed patch at line 11: @@ -140,7 +141,7 @@

[root@echo /usr/ports/ftp/proftpd]#

Can anyone spot where I'm going wrong with this? I've never used diff file patches, and while I understand the concept I can't get it to work in practice.

Link to comment
Share on other sites

That patch IS malformatted. The ranges are wrong.

Look at the first hunk:

@@ -7,6 +7,7 @@

 PORTNAME=       proftpd

 DISTVERSION=    1.3.1rc1

+PORTREVISION=   1

 CATEGORIES=     ftp

 MASTER_SITES=   ftp://ftp.proftpd.org/distrib/source/ 

                 ftp://ftp.fastorama.com/mirrors/ftp.proftpd.org/distrib/source/

Count the lines. There are 5 total, and a 6th one is being added. the ranges should be 7,5 and 7,6.

I have no rational explanation why diff would output the lines in such a way. When I run that command locally I get the correct line numbers.

But to get you back on track:

@@ -7,6 +7,7 @@ should read @@ -7,5 +7,6 @@

and

@@ -140,7 +141,7 @@ should read @@ -140,5 +141,5 @@

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...