Subject: Patches, diffs and other monkeys

From: Brad Waite <[email-masked]>
Date: Mon, 17 Nov 1997 08:24:07 -0700

Hey all,
  Got a question concerning conventions.  I've modded my ftpd code quite
a bit for several projects.  Now I want to post one of 'em here ("'em"
being the solutions).  Since the code line numbers for project one are
affected by code from project two, how do I get a diff that can be used
by everyone else that doesn't have my project two changes?  Or does it
matter.  Is patch smart enough to put it in the right place?

-Brad

---

From: Gregory A Lundberg <[email-masked]>
Date: Mon, 17 Nov 1997 10:59:21 -0500 (EST)

> matter.  Is patch smart enough to put it in the right place?

Run diff against known-clean sources from BETA 15 (or whatever is latest
at the time).  To be sure, I usually grab a fresh copy from academ then cp
the original source into  my modified source directory, adding .orig to
the name.  To be verbose, I'd ...

  cd ~
  tar -zvxf ~/.archives/wu-ftpd-2.4.2-beta-15.tar.Z
  cp wu-ftpd-2.4.2-beta-15/src/ftpd.c ~/wuftpd/src/ftpd.c.orig
  cd ~/wuftpd/src
  diff -u ftpd.c.orig ftpd.c > ~/wuftpd/ftpd.c.diff

----

Gregory A Lundberg		Senior Partner, VRnet Company
1441 Elmdale Drive              email: [email-masked] [205.133.13.8]
Kettering, OH 45409-1615 USA    voice: +1 (937) 299-7653

---

From: Brad Waite <[email-masked]>
Date: Mon, 17 Nov 1997 09:13:16 -0700

That was my plan of action.  However, what I was getting at is that if I
only want to pull out one modification that I've made, the line numbers
will be offset from what they would be because of the other mods.  For
instance, here's the orig file:

hack.c.orig
main(){
	printf ("Hello World\n");
}

Here's my modifications:

hack.c.new
main(){
	printf ("\n\n");
	printf ("Hello World\n");
	printf ("Goodbye cruel world!\n");
}

And the diff -c:

*** hack.c.orig  Mon Nov 17 09:07:50 1997
--- hack.c.new  Mon Nov 17 09:07:45 1997
***************
*** 1,3 ****
--- 1,5 ----
  main(){
+       printf ("\n\n");
        printf ("Hello World\n");
+       printf ("Goodbye cruel world!\n");
  }

Now let's say that I only want to post the fix on line 5 of hack.c.new. 
How can I post it so that patch can handle just one mod?  If I just take
out line 2 of hack.c.new, now it's no longer "--- 1,5 ---" but "--- 1,4
---".  Do I have to make all those changes, too, or does patch not care?

Hope I've explained it better this time.

-Brad