LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 730|回复: 3

请问如何打补丁?

[复制链接]
发表于 2004-10-30 08:37:40 | 显示全部楼层 |阅读模式
我把源码补丁放在源码目录后,
用命令 bzip2 -dc mypatch.bz2 | patch -p1 后出现以下提示:
……
Hunk #21 succeeded at 3565 with fuzz 2 (offset 129 lines).
Hunk #22 succeeded at 3784 with fuzz 2 (offset 145 lines).
Hunk #23 FAILED at 3833.
12 out of 23 hunks FAILED -- saving rejects to file CREDITS.rej
patching file Documentation/CodingStyle
Reversed (or previously applied) patch detected!  Assume -R? [n]
这个是什么意思啊?
无论我怎么回答,后面又一直提问,烦死了。
要怎么才能一次性把补丁打上呢?

如果用 bzip2 -dc mypatch.bz2 | patch -p10 ,出现提示如下:
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Nru a/CREDITS b/CREDITS
|--- a/CREDITS  2004-10-18 14:56:48 -07:00
|+++ b/CREDITS  2004-10-18 14:56:48 -07:00
--------------------------
File to patch:
这又怎么办?


patch 的p参数后面的数字到底代表什么啊?man看了半天仍不懂。

谢谢各位大大帮我这只初飞的菜鸟吧!!!
 楼主| 发表于 2004-10-30 09:35:36 | 显示全部楼层
怀疑ing。。。
难道patch是用来升级旧版本source的?
也就是说新版本的source已经patch好了?
比如kernel269-patch是用来patch kernel268的?
发表于 2004-10-30 12:05:31 | 显示全部楼层
在你的patch文件中,首行是要patch的文件
*** /home/test/test.old  xxxxxxxxxxx
--- /home/test/test.new  xxxxxxxxxxx
输入patch -p0 <test.patch
就代表寻找要patch的文件是/home/test/test.old
如果输入patch -p1 <test.patch
就代表寻找要patch的文件是home/test/test.old
如果是p3 就是test.old
px x代表拿下给个/
 楼主| 发表于 2004-10-30 15:43:18 | 显示全部楼层
谢谢!

我的猜测是对的,而且实验过了。
比如:
patch_2.4.3 记录着linux-2.4.3 和 linux-2.4.2之间的版本差异。
patch_2.4.4 记录着linux-2.4.4 and linux-2.4.3之间的版本差异。
patch_2.4.5 记录着linux-2.4.5 and linux-2.4.4之间的版本差异。

所以kernel269的patch是针对kernel268而言的。

唉,大家都懂得怎样用命令,却没人告诉我什么时候才能用。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表