From owner-freebsd-questions@FreeBSD.ORG Wed Oct 17 18:14:32 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4897416A4F5 for ; Wed, 17 Oct 2007 18:14:32 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id CE96B13C474 for ; Wed, 17 Oct 2007 18:14:30 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (vader.bytemobile.ondsl.gr [83.235.244.135]) (authenticated bits=128) by igloo.linux.gr (8.14.1/8.14.1/Debian-9) with ESMTP id l9HIE6U9020151 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 17 Oct 2007 21:14:20 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.1/8.14.1) with ESMTP id l9HDEQ3S002365; Wed, 17 Oct 2007 16:14:42 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.1/8.14.1/Submit) id l9HDEQ49002364; Wed, 17 Oct 2007 16:14:26 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Wed, 17 Oct 2007 16:14:25 +0300 From: Giorgos Keramidas To: "Aryeh M. Friedman" Message-ID: <20071017131425.GB2100@kobe.laptop> References: <4714D481.3090204@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4714D481.3090204@gmail.com> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.983, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.42, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-questions@freebsd.org Subject: Re: how to make a patch X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2007 18:14:32 -0000 On 2007-10-16 15:10, "Aryeh M. Friedman" wrote: > I found and fixed a bug in one of the ports how do I make a patch file > (I only changed one line in one file) and who do I send it to? If you know precisely the file, you can use diff(1) to generate the patch file. Note that patch files for ports have to be constructed in a "special" way, so that the "make patch" target can find them and apply them correctly. 1. Keep a copy of the patched file around, i.e. at `/tmp/foo.c' 2. Clean-up the "work" subdirectory of the port, and extract a clean version of the port's patched source: # cd /usr/ports/editors/foobar # rm -fr work # make patch 3. Enter the work/foobar-1.0 build directory of the port, and save the original, unpatched file you want to modify at port-build-time: # cd work/foobar-1.0 # cp src/foo.c src/foo.c.orig 4. Now overwrite the build-tree copy of `foo.c' with the saved copy from step 1. # cp /tmp/foo.c src/foo.c 5. Use the diff utility from within the `work/foobar-1.0' tree to generate a ports-based patch: # pwd /usr/ports/editors/foobar/work/foobar-1.0 # diff -u src/foo.c.orig src/foo.c > /tmp/patch-src-foo.c 6. Now that you have the 'fix' as a patch in /tmp/patch-src-foo.c, you can remove the temporary `work' directory of the port, and install the patch in `files' as a normal ports-based-patch: # cd /usr/ports/editors/foobar # rm -fr work # cp -i /tmp/patch-src-foo.c files/ If there's already an existing `patch-src-foo.c' file in `files', the last command will prompt you for overwriting the old patch. Don't do it. Just pick a non-conflicting name for the second patch which applies on top of `src/foo.c', i.e.: # cp -i /tmp/patch-src-foo.c files/patch-src-foo.c-bugfixname where `bugfixname' is a tag which can help the port maintainers understand why this patchfile is needed. After you have installed `patch-src-foo.c' in the `files' subdirectory of the port, you should be able to run: # cd /usr/ports/editors/foobar # make patch and your patchfile should be applied automatically.