From Bram@moolenaar.net  Thu Aug 11 20:14:40 2005
Return-Path: <Bram@moolenaar.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2038D16A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 11 Aug 2005 20:14:40 +0000 (GMT)
	(envelope-from Bram@moolenaar.net)
Received: from post-25.mail.nl.demon.net (post-25.mail.nl.demon.net [194.159.73.195])
	by mx1.FreeBSD.org (Postfix) with ESMTP id AF81143D45
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 11 Aug 2005 20:14:39 +0000 (GMT)
	(envelope-from Bram@moolenaar.net)
Received: from zimbu.demon.nl ([82.161.100.193]:51323 helo=moolenaar.net)
	by post-25.mail.nl.demon.net with esmtp (Exim 4.51)
	id 1E3JRm-0005au-Bn
	for FreeBSD-gnats-submit@freebsd.org; Thu, 11 Aug 2005 20:14:38 +0000
Received: from masaka.moolenaar.net (localhost.moolenaar.net [127.0.0.1])
	by moolenaar.net (8.13.1/8.13.1) with ESMTP id j7BHm8gc037514
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 11 Aug 2005 19:48:08 +0200 (CEST)
	(envelope-from Bram@moolenaar.net)
Received: (from mool@localhost)
	by masaka.moolenaar.net (8.13.1/8.13.1/Submit) id j7BHm8x0037513;
	Thu, 11 Aug 2005 19:48:08 +0200 (CEST)
	(envelope-from mool)
Message-Id: <200508111748.j7BHm8x0037513@masaka.moolenaar.net>
Date: Thu, 11 Aug 2005 19:48:08 +0200 (CEST)
From: Bram Moolenaar <Bram@moolenaar.net>
Reply-To: Bram Moolenaar <Bram@moolenaar.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: patch(1) inserts a line in the wrong place
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         84816
>Category:       bin
>Synopsis:       patch(1) inserts a line in the wrong place
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 11 20:20:16 GMT 2005
>Closed-Date:    Sun Jul 01 16:02:13 UTC 2012
>Last-Modified:  Sun Jul 01 16:02:13 UTC 2012
>Originator:     Bram Moolenaar
>Release:        FreeBSD 5.3-RELEASE i386
>Organization:
Zimbu Labs
>Environment:
System: FreeBSD masaka.moolenaar.net 5.3-RELEASE FreeBSD 5.3-RELEASE #12: Wed Mar 2 20:26:40 CET 2005 mool@masaka.moolenaar.net:/usr/src/sys/i386/compile/MASAKA i386


>Description:
	When patching a file, where the change is that one line is inserted at
	the start of the file, the new line ends up as the second line instead.
	This only appears to happen when the diff file was generated with a
	context of one line "diff -C 1".

>How-To-Repeat:
	Example original file:
		asdf 1
		asdf 2
	
	Example of the patched file as it should end up:
		999999
		asdf 1
		asdf 2
	
	The diff file used, generated with "diff -C 1"
		*** try.orig	Thu Aug 11 19:33:39 2005
		--- try	Thu Aug 11 19:33:53 2005
		***************
		*** 1 ****
		--- 1,2 ----
		+ 999999
		  asdf 1

	The resulting patched file:
		asdf 1
		999999
		asdf 2
		
>Fix:
	Unknown.  I tried changing the "1" in the diff file to "1,1", but that
	didn't help.  The contents of the file doesn't seem to matter.  When
	using a different number of context lines the bug does not appear.


>Release-Note:
>Audit-Trail:

From: Gavin Atkinson <gavin.atkinson@ury.york.ac.uk>
To: bug-followup@FreeBSD.org, Bram@moolenaar.net
Cc:  
Subject: Re: bin/84816: patch(1) inserts a line in the wrong place
Date: Tue, 15 May 2007 17:25:15 +0100

 This is still an issue on 6.2-RELEASE
State-Changed-From-To: open->analyzed 
State-Changed-By: linimon 
State-Changed-When: Tue May 15 21:18:15 UTC 2007 
State-Changed-Why:  
Reported to still be a problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=84816 

From: Edwin Groothuis <edwin@freebsd.org>
To: FreeBSD Gnats Submit <freebsd-gnats-submit@freebsd.org>
Cc:  
Subject: Re: bin/84816: patch(1) inserts a line in the wrong place
Date: Thu, 7 Aug 2008 00:20:30 +1000

 See also
 
 bin/74127: [patch] patch(1) may misapply hunks with too little context
State-Changed-From-To: analyzed->closed 
State-Changed-By: eadler 
State-Changed-When: Sun Jul 1 16:02:11 UTC 2012 
State-Changed-Why:  
see bin/74127 

http://www.freebsd.org/cgi/query-pr.cgi?pr=84816 
>Unformatted:
