最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】打补丁时出错:Patch failed! Please fix m4-1.4.16-no-fpending-redefinition.patch!

diff crifan 9828浏览 0评论

【问题】

折腾:

【未解决】patch打补丁时出错:patch: **** malformed patch at line

期间,虽然已经解决了:

【已解决】打patch补丁时出错:Reversed (or previously applied) patch detected! Assume -R? [n]

但是接着又出现错误:

CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05
$ make
>>> host-m4 1.4.16 Patching package//m4

Applying m4-1.4.16-001-MB_CUR_MAX.patch using patch:
patching file lib/regcomp.c
Hunk #1 succeeded at 895 with fuzz 2 (offset 24 lines).

Applying m4-1.4.16-no-fpending-redefinition.patch using patch:
patching file ChangeLog
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file ChangeLog.rej
patching file lib/fpending.h
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 FAILED at 20.
1 out of 1 hunk FAILED -- saving rejects to file lib/fpending.h.rej
patching file m4/fpending.m4
Patch failed!  Please fix m4-1.4.16-no-fpending-redefinition.patch!
make: *** [/home/CLi/develop/buildroot/buildroot-2013.05/output/build/host-m4-1.4.16/.stamp_patched] Error 1

如图:

Patch failed Please fix m4-1.4.16-no-fpending-redefinition.patch

即:

Patch failed! Please fix m4-1.4.16-no-fpending-redefinition.patch!

【解决过程】

1.很明显,是patch出错了。

2.后来自己看出来了,是自己的patch有问题。

因为自己的patch文件:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\buildroot\buildroot-2013.05\package\m4\m4-1.4.16-no-fpending-redefinition.patch

中的内容是:

diff -purN m4-1.4.16.orig/ChangeLog m4-1.4.16/ChangeLog
--- m4-1.4.16.orig/ChangeLog	2011-03-02 02:39:40.000000000 +0800
+++ m4-1.4.16/ChangeLog	2013-08-28 13:25:09.128914000 +0800
@@ -1,3 +1,8 @@
+2013-08-28  Crifan Li <[email protected]>
+
......

即,开始部分的是:

m4-1.4.16.orig

m4-1.4.16

而正常的别人的patch:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\buildroot\buildroot-2013.05\package\m4\m4-1.4.16-no-gets-and-missing-binary-operator.patch

是:

host-m4-1.4.16.orig

host-m4-1.4.16

3.所以,重新去:

【记录】尝试为了Buildroot编译期间涉及到的m4-1.4.16的fpending在Cygwin下的问题去制作diff和patch补丁包

再制作一个新的patch文件:

m4-1.4.16-no-__fpending-redefine.patch

然后制作出来的patch,就是host开头的了:

then patch is host prefix

4.重新:

删除旧的:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\buildroot\buildroot-2013.05\package\m4\m4-1.4.16-no-fpending-redefinition.patch

拷贝新的:

m4-1.4.16-no-__fpending-redefine.patch

到:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\buildroot\buildroot-2013.05\package\m4\m4-1.4.16-no-__fpending-redefine.patch

然后再去buildroot中make试试,然后就可以成功打补丁,可以正常编译通过了:

CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05
$ make
>>> host-m4 1.4.16 Patching package//m4

Applying m4-1.4.16-001-MB_CUR_MAX.patch using patch:
patching file lib/regcomp.c
Hunk #1 succeeded at 899 with fuzz 2 (offset 28 lines).

Applying m4-1.4.16-no-__fpending-redefine.patch using patch:
patching file ChangeLog
Reversed (or previously applied) patch detected!  Assume -R? [n] y
patching file lib/fpending.h
Reversed (or previously applied) patch detected!  Assume -R? [n] y
patching file m4/fpending.m4
Reversed (or previously applied) patch detected!  Assume -R? [n] y

Applying m4-1.4.16-no-gets-and-missing-binary-operator.patch using patch:
patching file lib/stdio.in.h

如图:

patching new patch for m4 fpending m4 ok

 

【总结】

buildroot中make编译期间,去打补丁patch时出现:

Patch failed!  Please fix m4-1.4.16-no-fpending-redefinition.patch!

的错误的,

原因是:

之前通过:

【记录】尝试为了Buildroot编译期间涉及到的m4-1.4.16的fpending在Cygwin下的问题去制作diff和patch补丁包

制作出来的patch,是:

— m4-1.4.16.orig/xxx

+++ m4-1.4.16/xxx

的,而当前m4的实际路径是:

host-m4-1.4.16

解决办法是:

去重新制作patch,即:

把原先的

m4-1.4.16

m4-1.4.16.orig

两个文件夹,改名为:

host-m4-1.4.16

host-m4-1.4.16.orig

后,再重新制作一次:

diff -purN host-m4-1.4.16.orig/ host-m4-1.4.16/ > m4-1.4.16-no-__fpending-redefine.patch

即可patch是正确的,后续应用此patch时就正常了。

转载请注明:在路上 » 【已解决】打补丁时出错:Patch failed! Please fix m4-1.4.16-no-fpending-redefinition.patch!

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
85 queries in 0.162 seconds, using 22.08MB memory