[OE-core] [PATCH] dhcp: Revert "dhcp: enable gentle shutdown" and reset handler
This reverts commit 4653fdd4b4cf13543e32fbcf09e50f60c1719a34 This patch is used to solve the problem in which dhcpd can not be killed by SIGINT and SIGTERM. But it seems not good to rely on ENABLE_GENTLE_SHUTDOWN, which is an "undesireable feature" and will release its address after receive both signal, accoring to the comment in "includes/site.h". Then there is no difference between "dhclient -x" and "dhclient -r". We can find following call trace from source code: main() -> dhcp_context_create() -> isc_app_ctxstart() -> isc__app_ctxstart() The root cause is that exit_action() is registered as the signal handler for SIGTERM and SIGINT, which do-nothing as the comment says. To fix this problem, we could simply set the default action for these two signals if ENABLE_GENTLE_SHUTDOWN is not set. Signed-off-by: Rui Wang --- ...et-default-handler-for-SIGTERM-and-SIGINT.patch | 63 ++ .../dhcp/0006-site.h-enable-gentle-shutdown.patch | 27 -- meta/recipes-connectivity/dhcp/dhcp_4.4.1.bb | 2 +- 3 files changed, 64 insertions(+), 28 deletions(-) create mode 100644 meta/recipes-connectivity/dhcp/dhcp/0001-dhcp-set-default-handler-for-SIGTERM-and-SIGINT.patch delete mode 100644 meta/recipes-connectivity/dhcp/dhcp/0006-site.h-enable-gentle-shutdown.patch diff --git a/meta/recipes-connectivity/dhcp/dhcp/0001-dhcp-set-default-handler-for-SIGTERM-and-SIGINT.patch b/meta/recipes-connectivity/dhcp/dhcp/0001-dhcp-set-default-handler-for-SIGTERM-and-SIGINT.patch new file mode 100644 index 000..d5c9e34 --- /dev/null +++ b/meta/recipes-connectivity/dhcp/dhcp/0001-dhcp-set-default-handler-for-SIGTERM-and-SIGINT.patch @@ -0,0 +1,63 @@ +From eaa74a4fd8ebcc031c63a8a39d20cd1ffe0eaf4f Mon Sep 17 00:00:00 2001 +From: Rui Wang +Date: Tue, 7 May 2019 10:41:20 +0800 +Subject: [PATCH] dhcp: set default handler for SIGTERM and SIGINT + +dhcp uses function in bind to init it's state, which will block +signal SIGTERM and SIGINT by default. This causes dhclient not +able to be killed by those two signals if gentle-shutdown is +disabled. So reset their signal handler to default in such +situation. + +Signed-off-by: Rui Wang +--- + client/dhclient.c | 3 +++ + relay/dhcrelay.c | 3 +++ + server/dhcpd.c| 3 +++ + 3 files changed, 9 insertions(+) + +diff --git a/client/dhclient.c b/client/dhclient.c +index 825ab00..159cf39 100644 +--- a/client/dhclient.c b/client/dhclient.c +@@ -971,6 +971,9 @@ main(int argc, char **argv) { + /* install signal handlers */ + signal(SIGINT, dhcp_signal_handler); /* control-c */ + signal(SIGTERM, dhcp_signal_handler); /* kill */ ++#else ++signal(SIGINT, SIG_DFL); ++signal(SIGTERM, SIG_DFL); + #endif + + /* If we're not supposed to wait before getting the address, +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index d8caaaf..ec22385 100644 +--- a/relay/dhcrelay.c b/relay/dhcrelay.c +@@ -814,6 +814,9 @@ main(int argc, char **argv) { + /* install signal handlers */ + signal(SIGINT, dhcp_signal_handler); /* control-c */ + signal(SIGTERM, dhcp_signal_handler); /* kill */ ++#else ++signal(SIGINT, SIG_DFL); ++signal(SIGTERM, SIG_DFL); + #endif + + /* Start dispatching packets and timeouts... */ +diff --git a/server/dhcpd.c b/server/dhcpd.c +index 55ffae7..f5aced3 100644 +--- a/server/dhcpd.c b/server/dhcpd.c +@@ -1052,6 +1052,9 @@ main(int argc, char **argv) { + /* install signal handlers */ + signal(SIGINT, dhcp_signal_handler); /* control-c */ + signal(SIGTERM, dhcp_signal_handler); /* kill */ ++#else ++signal(SIGINT, SIG_DFL); ++signal(SIGTERM, SIG_DFL); + #endif + + /* Log that we are about to start working */ +-- +1.8.3.1 + diff --git a/meta/recipes-connectivity/dhcp/dhcp/0006-site.h-enable-gentle-shutdown.patch b/meta/recipes-connectivity/dhcp/dhcp/0006-site.h-enable-gentle-shutdown.patch deleted file mode 100644 index 6ef70cc..000 --- a/meta/recipes-connectivity/dhcp/dhcp/0006-site.h-enable-gentle-shutdown.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 01641d146e4e6bea954e4a4ee1f6230b822665b4 Mon Sep 17 00:00:00 2001 -From: Chen Qi -Date: Tue, 15 Aug 2017 15:37:49 +0800 -Subject: [PATCH 06/11] site.h: enable gentle shutdown - -Upstream-Status: Inappropriate [configuration] -Signed-off-by: Chen Qi - -Rebase to 4.3.6 -Signed-off-by: Hongxu Jia - includes/site.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: dhcp-4.4.1/includes/site.h -=== dhcp-4.4.1.orig/includes/site.h -+++ dhcp-4.4.1/includes/site.h -@@ -295,7 +295,7 @@ -situations. We plan to revisit this feature and may -make non-backwards compatible changes including the -removal of this define. Use at your own risk. */ --/* #define ENABLE_GENTLE_SHUTDOWN */ -+#define ENABL
[OE-core] [PATCH] initscripts: fix missing chkconfig header in initscript
chkconfig needs a specific header to work properly, which indicates the initial start and stop order. Or it will mess up the priority of init scripts while enable or disable service. So it will be necessary to add this header into init script which supports chkconfig. Signed-off-by: Rui Wang --- meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon| 1 + meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver| 1 + meta/recipes-core/busybox/files/hwclock.sh | 1 + meta/recipes-core/busybox/files/syslog | 1 + meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init | 1 + meta/recipes-core/initscripts/initscripts-1.0/halt | 1 + meta/recipes-core/initscripts/initscripts-1.0/reboot | 1 + meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh | 1 + meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh | 1 + meta/recipes-core/initscripts/initscripts-1.0/sendsigs | 1 + meta/recipes-core/initscripts/initscripts-1.0/umountfs | 1 + meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh | 1 + meta/recipes-core/initscripts/initscripts-1.0/urandom | 1 + meta/recipes-core/sysvinit/sysvinit/bootlogd.init | 1 + meta/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.init | 1 + meta/recipes-extended/cronie/cronie/crond.init | 1 + meta/recipes-extended/rpcbind/rpcbind/init.d | 1 + 17 files changed, 17 insertions(+) diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon index 992267d5a1..44f9e896ff 100644 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon @@ -1,4 +1,5 @@ #!/bin/sh +# chkconfig: 2345 19 71 ### BEGIN INIT INFO # Provides: nfs-common # Required-Start:$portmap hwclock diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver index d5e9c38a9c..2772bb4b6c 100644 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver @@ -1,4 +1,5 @@ #!/bin/sh +# chkconfig: 2345 20 80 ### BEGIN INIT INFO # Provides: nfs-kernel-server # Required-Start:$remote_fs nfs-common $portmap hwclock diff --git a/meta/recipes-core/busybox/files/hwclock.sh b/meta/recipes-core/busybox/files/hwclock.sh index be5f94d86c..706126db1d 100644 --- a/meta/recipes-core/busybox/files/hwclock.sh +++ b/meta/recipes-core/busybox/files/hwclock.sh @@ -1,4 +1,5 @@ #!/bin/sh +# chkconfig: S 20 80 ### BEGIN INIT INFO # Provides: hwclock # Required-Start: diff --git a/meta/recipes-core/busybox/files/syslog b/meta/recipes-core/busybox/files/syslog index 89c4d12e9c..083d07c994 100644 --- a/meta/recipes-core/busybox/files/syslog +++ b/meta/recipes-core/busybox/files/syslog @@ -1,4 +1,5 @@ #! /bin/sh +# chkconfig: 2345 20 80 ### BEGIN INIT INFO # Provides: sysklogd # Required-Start: $remote_fs $time diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init index fb31c635be..1fc90bce98 100644 --- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init @@ -1,4 +1,5 @@ #!/bin/sh -e +# chkconfig: S 10 90 ### BEGIN INIT INFO # Provides: networking # Required-Start:mountvirtfs $local_fs diff --git a/meta/recipes-core/initscripts/initscripts-1.0/halt b/meta/recipes-core/initscripts/initscripts-1.0/halt index a56f73421b..dd0a59f25c 100755 --- a/meta/recipes-core/initscripts/initscripts-1.0/halt +++ b/meta/recipes-core/initscripts/initscripts-1.0/halt @@ -1,4 +1,5 @@ #!/bin/sh +# chkconfig: - 90 10 ### BEGIN INIT INFO # Provides: halt # Required-Start: diff --git a/meta/recipes-core/initscripts/initscripts-1.0/reboot b/meta/recipes-core/initscripts/initscripts-1.0/reboot index 087d8d5da4..6cf19f520b 100755 --- a/meta/recipes-core/initscripts/initscripts-1.0/reboot +++ b/meta/recipes-core/initscripts/initscripts-1.0/reboot @@ -1,4 +1,5 @@ #!/bin/sh +# chkconfig: - 90 10 ### BEGIN INIT INFO # Provides: reboot # Required-Start: diff --git a/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh b/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh index 76de3418ac..a10139d44d 100755 --- a/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh +++ b/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh @@ -1,4 +1,5 @@ #!/bin/sh +# chkconfig: 2345 99 01 ### BEGIN INIT INFO # Provides: rmnologin # Required-Start:$remote_fs $all diff --git a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh index 1632a5f649..abcdf5db06 100644 --- a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh +++ b/meta/recipes-core
[OE-core] [PATCH] attr: fix utime for symlink
Signed-off-by: Rui Wang cherry-pick of fa191666b with context for SRC_URI addition modified to apply to current recipe. Signed-off-by: Joe Slater --- .../unfs3/0001-attr-fix-utime-for-symlink.patch| 85 ++ meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb | 3 +- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch diff --git a/meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch b/meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch new file mode 100644 index 000..6957d10 --- /dev/null +++ b/meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch @@ -0,0 +1,85 @@ +From 3f4fcb62661059bad77a2e957b4621137797bc2f Mon Sep 17 00:00:00 2001 +From: Rui Wang +Date: Fri, 15 Jun 2018 14:19:10 +0800 +Subject: [PATCH] attr: fix utime for symlink + +unfs3 has an old defect that it can not change the timestamps of a +symlink file because it only uses utime(), which will follow the +symlink. This will not cause an error if the symlink points to an +existent file. But under some special situation, such as installing +a rpm package, rpm tool will create the symlink first and try to +modify the timestamps of it, when the target file is non-existent. +This will cause an ESTALE error. Making rpm tool ignore this error +is a solution, but not the best one. An acceptable approach is +Making unfs3 support lutimes(), which can modify the symlink file +itself. Considering not every system support this function, so a +function checking is necessary. + +Upstream-Status: Submitted [https://sourceforge.net/p/unfs3/bugs/12/] + +Signed-off-by: Rui Wang +--- + attr.c | 15 +++ + backend_unix.h | 2 ++ + configure.ac | 1 + + 3 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/attr.c b/attr.c +index 73e5c75..427d0e2 100644 +--- a/attr.c b/attr.c +@@ -280,7 +280,7 @@ post_op_attr get_post_cached(struct svc_req * req) + static nfsstat3 set_time(const char *path, backend_statstruct buf, sattr3 new) + { + time_t new_atime, new_mtime; +-struct utimbuf utim; ++struct timeval stamps[2]; + int res; + + /* set atime and mtime */ +@@ -302,10 +302,17 @@ static nfsstat3 set_time(const char *path, backend_statstruct buf, sattr3 new) + else /* DONT_CHANGE */ + new_mtime = buf.st_mtime; + +- utim.actime = new_atime; +- utim.modtime = new_mtime; ++ stamps[0].tv_sec = new_atime; ++ stamps[0].tv_usec = 0; ++ stamps[1].tv_sec = new_mtime; ++ stamps[1].tv_usec = 0; ++ ++#if HAVE_LUTIMES ++ res = backend_lutimes(path, stamps); ++#else ++ res = backend_utimes(path, stamps); ++#endif + +- res = backend_utime(path, ); + if (res == -1) + return setattr_err(); + } +diff --git a/backend_unix.h b/backend_unix.h +index fbc2af3..813ffd3 100644 +--- a/backend_unix.h b/backend_unix.h +@@ -61,6 +61,8 @@ + #define backend_symlink symlink + #define backend_truncate truncate + #define backend_utime utime ++#define backend_utimes utimes ++#define backend_lutimes lutimes + #define backend_statstruct struct stat + #define backend_dirstream DIR + #define backend_statvfsstruct struct statvfs +diff --git a/configure.ac b/configure.ac +index aeec598..ea7f167 100644 +--- a/configure.ac b/configure.ac +@@ -37,6 +37,7 @@ AC_CHECK_FUNCS(setresuid setresgid) + AC_CHECK_FUNCS(vsyslog) + AC_CHECK_FUNCS(lchown) + AC_CHECK_FUNCS(setgroups) ++AC_CHECK_FUNCS(lutimes) + UNFS3_SOLARIS_RPC + UNFS3_PORTMAP_DEFINE + UNFS3_COMPILE_WARNINGS diff --git a/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb b/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb index 8127e4a..5a81a8f 100644 --- a/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb +++ b/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb @@ -29,7 +29,8 @@ SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/unfs3-0.9.22.r497.ta file://relative_max_socket_path_len.patch \ file://tcp_no_delay.patch \ file://0001-daemon.c-Libtirpc-porting-fixes.patch \ - " + file://0001-attr-fix-utime-for-symlink.patch \ + " SRC_URI[md5sum] = "2e43e471c77ade0331901c40b8f8e9a3" SRC_URI[sha256sum] = "21009468a9ba07b72ea93780d025a63ab4e55bf8fc3127803c296f0900fe1bac" -- 1.9.1 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] attr: fix utime for symlink
Signed-off-by: Rui Wang cherry-pick of fa191666b with context for SRC_URI addition modified to apply to current recipe. Signed-off-by: Joe Slater --- .../unfs3/0001-attr-fix-utime-for-symlink.patch| 85 ++ meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb | 3 +- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch diff --git a/meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch b/meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch new file mode 100644 index 000..c32a484 --- /dev/null +++ b/meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch @@ -0,0 +1,85 @@ +From 3f4fcb62661059bad77a2e957b4621137797bc2f Mon Sep 17 00:00:00 2001 +From: Rui Wang +Date: Fri, 15 Jun 2018 14:19:10 +0800 +Subject: [PATCH] attr: fix utime for symlink + +unfs3 has an old defect that it can not change the timestamps of a +symlink file because it only uses utime(), which will follow the +symlink. This will not cause an error if the symlink points to an +existent file. But under some special situation, such as installing +a rpm package, rpm tool will create the symlink first and try to +modify the timestamps of it, when the target file is non-existent. +This will cause an ESTALE error. Making rpm tool ignore this error +is a solution, but not the best one. An acceptable approach is +Making unfs3 support lutimes(), which can modify the symlink file +itself. Considering not every system support this function, so a +function checking is necessary. + +Signed-off-by: Rui Wang +--- + attr.c | 15 +++ + backend_unix.h | 2 ++ + configure.ac | 1 + + 3 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/attr.c b/attr.c +index 73e5c75..427d0e2 100644 +--- a/attr.c b/attr.c +@@ -280,7 +280,7 @@ post_op_attr get_post_cached(struct svc_req * req) + static nfsstat3 set_time(const char *path, backend_statstruct buf, sattr3 new) + { + time_t new_atime, new_mtime; +-struct utimbuf utim; ++struct timeval stamps[2]; + int res; + + /* set atime and mtime */ +@@ -302,10 +302,17 @@ static nfsstat3 set_time(const char *path, backend_statstruct buf, sattr3 new) + else /* DONT_CHANGE */ + new_mtime = buf.st_mtime; + +- utim.actime = new_atime; +- utim.modtime = new_mtime; ++ stamps[0].tv_sec = new_atime; ++ stamps[0].tv_usec = 0; ++ stamps[1].tv_sec = new_mtime; ++ stamps[1].tv_usec = 0; ++ ++#if HAVE_LUTIMES ++ res = backend_lutimes(path, stamps); ++#else ++ res = backend_utimes(path, stamps); ++#endif + +- res = backend_utime(path, ); + if (res == -1) + return setattr_err(); + } +diff --git a/backend_unix.h b/backend_unix.h +index fbc2af3..813ffd3 100644 +--- a/backend_unix.h b/backend_unix.h +@@ -61,6 +61,8 @@ + #define backend_symlink symlink + #define backend_truncate truncate + #define backend_utime utime ++#define backend_utimes utimes ++#define backend_lutimes lutimes + #define backend_statstruct struct stat + #define backend_dirstream DIR + #define backend_statvfsstruct struct statvfs +diff --git a/configure.ac b/configure.ac +index aeec598..ea7f167 100644 +--- a/configure.ac b/configure.ac +@@ -37,6 +37,7 @@ AC_CHECK_FUNCS(setresuid setresgid) + AC_CHECK_FUNCS(vsyslog) + AC_CHECK_FUNCS(lchown) + AC_CHECK_FUNCS(setgroups) ++AC_CHECK_FUNCS(lutimes) + UNFS3_SOLARIS_RPC + UNFS3_PORTMAP_DEFINE + UNFS3_COMPILE_WARNINGS +-- +1.9.1 diff --git a/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb b/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb index 8127e4a..5a81a8f 100644 --- a/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb +++ b/meta/recipes-devtools/unfs3/unfs3_0.9.22.r497.bb @@ -29,7 +29,8 @@ SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/unfs3-0.9.22.r497.ta file://relative_max_socket_path_len.patch \ file://tcp_no_delay.patch \ file://0001-daemon.c-Libtirpc-porting-fixes.patch \ - " + file://0001-attr-fix-utime-for-symlink.patch \ + " SRC_URI[md5sum] = "2e43e471c77ade0331901c40b8f8e9a3" SRC_URI[sha256sum] = "21009468a9ba07b72ea93780d025a63ab4e55bf8fc3127803c296f0900fe1bac" -- 1.9.1 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] bash: fix wrong exit status offset
In Linux,8 bits of the return code and 8 bits of the number of the killing signal are mixed into a single value on the exit code, so the exit status offset should be 8. But the autoconf checker can not determine it while cross compiling, and then it is set to the default value 0, which will cause generating the wrong exit code if program exit with an error code. Signed-off-by: Rui Wang --- meta/recipes-extended/bash/bash.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc index f4e1f7a11f..ada9f51ca2 100644 --- a/meta/recipes-extended/bash/bash.inc +++ b/meta/recipes-extended/bash/bash.inc @@ -7,7 +7,7 @@ DEPENDS = "ncurses bison-native virtual/libiconv" inherit autotools gettext texinfo update-alternatives ptest EXTRA_AUTORECONF += "--exclude=autoheader --exclude=aclocal" -EXTRA_OECONF = "--enable-job-control --without-bash-malloc" +EXTRA_OECONF = "--enable-job-control --without-bash-malloc bash_cv_wexitstatus_offset=8" # If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the # startup files, even if they are not interactive. -- 2.13.3 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core