打补丁常见错误patch: **** malformed patch at line

来源:互联网 发布:法国娇兰 淘宝 编辑:程序博客网 时间:2024/06/14 17:53

patch: **** malformed patch at line 10
正确没改动的文件如下:
--- strace-4.5.16-orig/syscall.c    2005-06-08 21:45:28.000000000+0100+++ strace-4.5.16/syscall.c    2005-10-25 19:26:39.000000000+0100@@ -1045,6 +1045,15 @@ struct tcb *tcp;<span style="color:#00cccc;BACKGROUND-COLOR: #ffffff">         /*          * Note: we only deal with only 32-bit CPUs here.          */</span><span style="color:#ff0000;BACKGROUND-COLOR: #ffffff">++        if(!(tcp->flags& TCB_INSYSCALL)&&+         (tcp->flags& TCB_WAITEXECVE)){+            /* caught a fake syscall from the execve's exit */+            tcp->flags&= ~TCB_WAITEXECVE;+            return 0;+        }+ +</span><span style="color:#00cccc;BACKGROUND-COLOR: #ffffff">         if (regs.ARM_cpsr & 0x20) {             /*              * Get the Thumb-mode system call number     </span>

数字6,表示记录了6行(蓝色部分)原始文件,数字15(蓝色加红色)表示记录了15行目标文件

如果去掉9个加号如下所示:
--- strace-4.5.16-orig/syscall.c    2005-06-08 21:45:28.000000000+0100+++ strace-4.5.16/syscall.c    2005-10-25 19:26:39.000000000+0100@@ -1045,6 +1045,15 @@ struct tcb *tcp;         /*          * Note: we only deal with only 32-bit CPUs here.          */        if(!(tcp->flags& TCB_INSYSCALL)&&         (tcp->flags& TCB_WAITEXECVE)){            /* caught a fake syscall from the execve's exit */            tcp->flags&= ~TCB_WAITEXECVE;            return 0;       }          if (regs.ARM_cpsr & 0x20) {             /*              * Get the Thumb-mode system call number      


这是你应用这个补丁,patch 就会提示失败,并输出:

patch: **** malformed patch at line xxx

应用时,patch 都会检查受影响的行是否与记录在两个 @@ 之间的数值一致,更改后,记录的原始文件行数为15,因此patch会失败。

将@@ -104,6 +104,15 @@ 改为@@ -104,15 +104,15 @@ 即可成功打上patch


0 0
原创粉丝点击