>我正在尝试在下面的包中的 watchdog.c 文件中添加一些检查,但出现如下补丁失败错误,手动补丁工作正常,没有任何问题,也补丁是从这个 pkg 的文件创建的,所以版本不匹配或旧版本没有问题。
https://sourceforge.net/projects/watchdog/files/watchdog/5.13/
ERROR: Command Error: exit status: 1 Output:
Applying patch watchdog.patch
patching file src/watchdog.c
Hunk #2 succeeded at 948 with fuzz 1.
Hunk #3 FAILED at 1057.
1 out of 3 hunks FAILED -- rejects in file src/watchdog.c
Patch watchdog.patch does not apply (enforce with -f)
ERROR: Function failed: patch_do_patch
试图搜索答案,但是
位烘焙配方未按预期应用补丁
为什么此修补程序以模糊值 1 应用,而在模糊值为 0 时失败?
大块头 #1 在 1 处失败。这是什么意思?
Above posts mention about pkg or improper patch issue, which doesnt look to be for my pkg, requesting for help on this.
diff --git a/src/watchdog.c b/src/watchdog.c
index 8a09632..bb4a189 100644
--- a/src/watchdog.c
+++ b/src/watchdog.c
@@ -570,6 +570,7 @@
struct stat s;
struct icmp_filter filt;
filt.data = ~(1<<ICMP_ECHOREPLY);
+ int check = FALSE;
#if USE_SYSLOG
char *opts = "d:i:n:Ffsvbql:p:t:c:r:m:a:";
@@ -947,6 +948,11 @@
(void) fclose(fp);
}
+ check = check_product();
+ if(check == TRUE)
+ {
+ setup_files();
+ }
/* set signal term to set our run flag to 0 so that */
/* we make sure watchdog device is closed when receiving SIGTERM */
signal(SIGTERM, sigterm_handler);
@@ -1051,6 +1057,11 @@
do_check2(check_bin(act->name, timeout, 1), act->name, rbinary, NULL);
#endif
+ if(check == TRUE)
+ {
+ do_check(test_files(), repair_bin, NULL);
+ }
+
/* finally sleep some seconds */
usleep(tint * 500000); /* this should make watchdog sleep tint seconds alltogther */
/* sleep(tint); */
.bbappend 文件
# changes for patching the disk IO check
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
FILESEXTRAPATHS_append := "${THISDIR}/files"
SRC_URI += "
file://watchdog.patch
"
上面的"SRC_URI"和"SRC_URI_machineoverride"一一尝试,没有用
SRC_URI_machineoverride += "file://watchdog.patch"
问题可能是您在SRC_URI中file://watchdog.patch
两次,并且 bitbake 尝试应用它两次。因此,第二个失败了。
尝试删除SRC_URI_machineoverride
行。
您当前的补丁文件与 https://sourceforge.net/projects/watchdog/files/watchdog/5.13/中找到的源代码不匹配
我已经手动将更改添加到文件中 https://sourceforge.net/projects/watchdog/files/watchdog/5.13/补丁如下,
--- a/src/watchdog.c 2020-07-02 13:57:45.771971643 +0200
+++ b/src/watchdog.c 2020-07-02 13:57:55.979985941 +0200
@@ -567,6 +567,7 @@
pid_t child_pid;
int oom_adjusted = 0;
struct stat s;
+ int check = FALSE
#if USE_SYSLOG
char *opts = "d:i:n:Ffsvbql:p:t:c:r:m:a:";
@@ -1053,6 +1054,10 @@
do_check2(check_bin(act->name, timeout, 1), act->name, rbinary, NULL);
#endif
+ if(check == TRUE)
+ {
+ do_check(test_files(), repair_bin, NULL);
+ }
/* finally sleep some seconds */
usleep(tint * 500000); /* this should make watchdog sleep tint seconds alltogther */
/* sleep(tint); */