From owner-freebsd-bugs Wed Apr 2 14:00:06 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id OAA27954 for bugs-outgoing; Wed, 2 Apr 1997 14:00:06 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id OAA27937; Wed, 2 Apr 1997 14:00:02 -0800 (PST) Date: Wed, 2 Apr 1997 14:00:02 -0800 (PST) Message-Id: <199704022200.OAA27937@freefall.freebsd.org> To: freebsd-bugs Cc: From: j@uriah.heep.sax.de (J Wunsch) Subject: Re: gnu/3176: `patch' creates files in wrong places (following Index) Reply-To: j@uriah.heep.sax.de (J Wunsch) Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk The following reply was made to PR gnu/3176; it has been noted by GNATS. From: j@uriah.heep.sax.de (J Wunsch) To: charnier@xp11.frmug.org Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: gnu/3176: `patch' creates files in wrong places (following Index) Date: Wed, 2 Apr 1997 23:47:14 +0200 As Philippe Charnier wrote: > cd a-1.0 > patch -p1 -N < ../file.patch > Hmm... Looks like a unified diff to me... > The text leading up to this was: > -------------------------- > |Index: b/file > |--- /dev/null Wed Apr 2 20:33:10 1997 > |+++ a-2.0/b/file Wed Apr 2 21:58:35 1997 > -------------------------- > (Creating file file...) <------------- should be b/file > Patching file file using Plan A... > Hunk #1 succeeded at 1. > done > > >Fix: > If the line `Index: b/file' is not provided, the command works as > expected. If not, the -p1 option is applied against Index. This is expected behaviour. ``The Index line, if present, takes precedence over the context diff header.'' Options like -p1 are applied after guessing the filename, so it will be applied to `b/file' in your case, stripping the `b/' of it, and leaving just `file'. ``Fixing'' this behaviour would royally screw CVS diffs that heavily rely on the Index: magic. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)