Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Aug 2005 19:48:08 +0200 (CEST)
From:      Bram Moolenaar <Bram@moolenaar.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/84816: patch(1) inserts a line in the wrong place
Message-ID:  <200508111748.j7BHm8x0037513@masaka.moolenaar.net>
Resent-Message-ID: <200508112020.j7BKKGRM068916@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         84816
>Category:       bin
>Synopsis:       patch(1) inserts a line in the wrong place
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 11 20:20:16 GMT 2005
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508111748.j7BHm8x0037513>