Date: Fri, 19 Nov 2004 14:30:00 -0500 (EST) From: Mikhail Teterin <mi+mailmx@aldan.algebra.com> To: FreeBSD-gnats-submit@FreeBSD.org Cc: Larry Wall <lwall@netlabs.com> Subject: bin/74127: patch(1) may misapply hunks with too little context Message-ID: <200411191930.iAJJU05M028437@250-217.customer.cloud9.net> Resent-Message-ID: <200411191940.iAJJeW7m023779@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 74127 >Category: bin >Synopsis: patch(1) may misapply hunks with too little context >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Nov 19 19:40:29 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Mikhail Teterin >Release: FreeBSD 5.3-STABLE i386 >Organization: Virtual Estates, Inc. >Environment: System: FreeBSD mi.us.murex.com 5.3-STABLE FreeBSD 5.3-STABLE #3: Tue Nov 9 17:40:11 EST 2004 mteterin@mi.us.murex.com:/meow/obj/misha/src/sys/Gigabyte i386 >Description: A patch produced with `diff -U0' or `-U1' may be misapplied if the file being patched changes (is of newer version) and the hunk is no longer applicable. patch(1) should fail loudly in this case, instead it sticks the new lines at the old location. >How-To-Repeat: Try applying this patch: --- l Mon Apr 3 20:00:28 2000 +++ l Fri May 5 10:01:58 2000 @@ -5,1 +5,1 @@ - set Log(compressProg) /usr/local/bin/gzip + set Log(compressProg) /usr/bin/gzip to this file: # This program is used to compress log files if {![info exists Log(compressProg)]} { set Log(compressProg) gzip } # Flush interval if {![info exists Log(flushInterval)]} { set Log(flushInterval) [expr {60 * 1000}] } # This is used to turn on an alternate debug log file if {![info exist Log(debug_log)]} { set Log(debug_log) 0 } It should not apply at all. Instead, one gets the reassuring: ``Hunk #1 succeeded at 5 with fuzz 1.'' and a botched file. >Fix: Use larger context, which is not always convenient. >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411191930.iAJJU05M028437>