Bug 450420 - patch silently fails to apply hunk of a patch
Summary: patch silently fails to apply hunk of a patch
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: patch
Version: 9
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-06-08 03:18 UTC by Rik van Riel
Modified: 2008-06-10 10:50 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-06-10 10:50:25 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
vmscan.c (58.18 KB, application/octet-stream)
2008-06-08 03:18 UTC, Rik van Riel
no flags Details
patch that caused the problem (8.71 KB, application/octet-stream)
2008-06-08 03:18 UTC, Rik van Riel
no flags Details

Description Rik van Riel 2008-06-08 03:18:00 UTC
Description of problem:

patching file mm/vmscan.c
Hunk #1 succeeded at 917 (offset 24 lines).
Hunk #2 FAILED at 973.
Hunk #3 succeeded at 1029 (offset -5 lines).
Hunk #4 succeeded at 1183 (offset 1 line).
Hunk #5 succeeded at 1186 (offset -5 lines).
Hunk #6 succeeded at 1217 (offset 1 line).
Hunk #7 FAILED at 1264.
Hunk #8 FAILED at 1291.
Hunk #9 succeeded at 1298 (offset -5 lines).
3 out of 9 hunks FAILED -- saving rejects to file mm/vmscan.c.rej

... except hunk #5 was not actually applied, but instead silently lost.

Version-Release number of selected component (if applicable):

patch-2.5.4-32.fc9.x86_64

How reproducible:

Attached are:
1) the original vmscan.c
2) patch file with chunk #5 failing silently

Steps to Reproduce:
1. try to apply the patch to vmscan.c

Comment 1 Rik van Riel 2008-06-08 03:18:00 UTC
Created attachment 308628 [details]
vmscan.c

Comment 2 Rik van Riel 2008-06-08 03:18:41 UTC
Created attachment 308629 [details]
patch that caused the problem

Comment 3 Tim Waugh 2008-06-10 10:50:25 UTC
Can't reproduce that here I'm afraid:

[tim@worm ~]$ filterdiff -i '*/vmscan.c' --hunk=5
rvr-04-linux-2.6-scan-ratio-fixes.patch 
--- linux-2.6.26-rc2-mm1.orig/mm/vmscan.c       2008-05-28 12:11:38.000000000 -0400
+++ linux-2.6.26-rc2-mm1/mm/vmscan.c    2008-05-28 12:11:51.000000000 -0400
@@ -1180,15 +1180,19 @@ static void get_scan_ratio(struct zone *
        file  = zone_page_state(zone, NR_ACTIVE_FILE) +
                zone_page_state(zone, NR_INACTIVE_FILE);
 
-       rotate_sum = zone->recent_rotated_file + zone->recent_rotated_anon;
-
        /* Keep a floating average of RECENT references. */
-       if (unlikely(rotate_sum > min(anon, file))) {
+       if (unlikely(zone->recent_scanned_anon > anon / zone->inactive_ratio)) {
                spin_lock_irq(&zone->lru_lock);
-               zone->recent_rotated_file /= 2;
+               zone->recent_scanned_anon /= 2;
                zone->recent_rotated_anon /= 2;
                spin_unlock_irq(&zone->lru_lock);
-               rotate_sum /= 2;
+       }
+
+       if (unlikely(zone->recent_scanned_file > file / 4)) {
+               spin_lock_irq(&zone->lru_lock);
+               zone->recent_scanned_file /= 2;
+               zone->recent_rotated_file /= 2;
+               spin_unlock_irq(&zone->lru_lock);
        }
 
        /*
[tim@worm ~]$ sha1sum vmscan.c rvr-04-linux-2.6-scan-ratio-fixes.patch 
1a23376211c806e76cadd42729aac9168bcd8f1f  vmscan.c
ff060add298b5da766615361c5af8943e4cb6e4a  rvr-04-linux-2.6-scan-ratio-fixes.patch
[tim@worm ~]$ filterdiff -i '*/vmscan.c' rvr-04-linux-2.6-scan-ratio-fixes.patch
| patch vmscan.c
patching file vmscan.c
Hunk #1 succeeded at 917 (offset 24 lines).
Hunk #2 FAILED at 973.
Hunk #3 succeeded at 1029 (offset -5 lines).
Hunk #4 succeeded at 1183 (offset 1 line).
Hunk #5 succeeded at 1186 (offset -5 lines).
Hunk #6 succeeded at 1217 (offset 1 line).
Hunk #7 FAILED at 1264.
Hunk #8 FAILED at 1291.
Hunk #9 succeeded at 1298 (offset -5 lines).
3 out of 9 hunks FAILED -- saving rejects to file vmscan.c.rej
[tim@worm ~]$ sed -ne '1185,1203p' vmscan.c
        file  = zone_page_state(zone, NR_ACTIVE_FILE) +
                zone_page_state(zone, NR_INACTIVE_FILE);

        /* Keep a floating average of RECENT references. */
        if (unlikely(zone->recent_scanned_anon > anon / zone->inactive_ratio)) {
                spin_lock_irq(&zone->lru_lock);
                zone->recent_scanned_anon /= 2;
                zone->recent_rotated_anon /= 2;
                spin_unlock_irq(&zone->lru_lock);
        }

        if (unlikely(zone->recent_scanned_file > file / 4)) {
                spin_lock_irq(&zone->lru_lock);
                zone->recent_scanned_file /= 2;
                zone->recent_rotated_file /= 2;
                spin_unlock_irq(&zone->lru_lock);
        }

        /*
[tim@worm ~]$ rpm -q patch
patch-2.5.4-32.fc9.x86_64



Note You need to log in before you can comment on or make changes to this bug.