bin/84816: patch(1) inserts a line in the wrong place

Bram Moolenaar Bram at moolenaar.net
Thu Aug 11 20:20:17 GMT 2005


>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 at 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:


More information about the freebsd-bugs mailing list