bin/74127: patch(1) may misapply hunks with too little context
Mikhail Teterin
mi+mailmx at aldan.algebra.com
Fri Nov 19 11:40:33 PST 2004
>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 at 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:
More information about the freebsd-bugs
mailing list