diff --git a/backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch b/backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch index 17e0d0b..8c68ab4 100644 --- a/backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch +++ b/backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch @@ -16,8 +16,8 @@ index 92815b1dbaea..1c8159a23550 100644 if (!separate_argv0) { char *w = NULL; -- if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) -+ if (!GREEDY_REALLOC0(n, nbufsize, nlen + 2)) +- if (!GREEDY_REALLOC(n, nlen + 2)) ++ if (!GREEDY_REALLOC0(n, nlen + 2)) return log_oom(); w = strdup(path); @@ -25,8 +25,8 @@ index 92815b1dbaea..1c8159a23550 100644 p += 2; p += strspn(p, WHITESPACE); -- if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) -+ if (!GREEDY_REALLOC0(n, nbufsize, nlen + 2)) +- if (!GREEDY_REALLOC(n, nlen + 2)) ++ if (!GREEDY_REALLOC0(n, nlen + 2)) return log_oom(); w = strdup(";"); diff --git a/backport-fix-ConditionDirectoryNotEmpty-when-it-comes-to-a-No.patch b/backport-fix-ConditionDirectoryNotEmpty-when-it-comes-to-a-No.patch new file mode 100644 index 0000000..6e026b3 --- /dev/null +++ b/backport-fix-ConditionDirectoryNotEmpty-when-it-comes-to-a-No.patch @@ -0,0 +1,26 @@ +From 193105f2d0408e2d96265935174b3cf0f100ef2e Mon Sep 17 00:00:00 2001 +From: jiangchuangang +Date: Mon, 29 Nov 2021 22:30:37 +0800 +Subject: [PATCH] fix ConditionDirectoryNotEmpty when it comes to a + Non-directory file + +--- + src/shared/condition.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/shared/condition.c b/src/shared/condition.c +index 6e769e9d59..a86f2b9ffb 100644 +--- a/src/shared/condition.c ++++ b/src/shared/condition.c +@@ -931,7 +931,7 @@ static int condition_test_directory_not_empty(Condition *c, char **env) { + assert(c->type == CONDITION_DIRECTORY_NOT_EMPTY); + + r = dir_is_empty(c->parameter); +- return r <= 0 && r != -ENOENT; ++ return r <= 0 && !IN_SET(r, -ENOENT, -ENOTDIR); + } + + static int condition_test_file_not_empty(Condition *c, char **env) { +-- +2.27.0 + diff --git a/backport-fix-ConditionPathIsReadWrite-when-path-does-not-exis.patch b/backport-fix-ConditionPathIsReadWrite-when-path-does-not-exis.patch new file mode 100644 index 0000000..6c8b7f2 --- /dev/null +++ b/backport-fix-ConditionPathIsReadWrite-when-path-does-not-exis.patch @@ -0,0 +1,33 @@ +From 7c4c9948d02ceda903ed4e4deea0d0084612625a Mon Sep 17 00:00:00 2001 +From: jiangchuangang +Date: Tue, 30 Nov 2021 15:25:27 +0800 +Subject: [PATCH] fix ConditionPathIsReadWrite when path does not exist. + +--- + src/shared/condition.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/shared/condition.c b/src/shared/condition.c +index a86f2b9ffb..dae75a5bf5 100644 +--- a/src/shared/condition.c ++++ b/src/shared/condition.c +@@ -894,11 +894,15 @@ static int condition_test_path_is_mount_point(Condition *c, char **env) { + } + + static int condition_test_path_is_read_write(Condition *c, char **env) { ++ int r; ++ + assert(c); + assert(c->parameter); + assert(c->type == CONDITION_PATH_IS_READ_WRITE); + +- return path_is_read_only_fs(c->parameter) <= 0; ++ r = path_is_read_only_fs(c->parameter); ++ ++ return r <= 0 && r != -ENOENT; + } + + static int condition_test_cpufeature(Condition *c, char **env) { +-- +2.27.0 + diff --git a/backport-fix-DirectoryNotEmpty-when-it-comes-to-a-Non-directo.patch b/backport-fix-DirectoryNotEmpty-when-it-comes-to-a-Non-directo.patch new file mode 100644 index 0000000..3234d28 --- /dev/null +++ b/backport-fix-DirectoryNotEmpty-when-it-comes-to-a-Non-directo.patch @@ -0,0 +1,25 @@ +From 5896a9ebdbe4d38c01390d0a5e82f9fcb4971059 Mon Sep 17 00:00:00 2001 +From: yangmingtai <961612727@qq.com> +Date: Mon, 6 Dec 2021 17:06:13 +0800 +Subject: [PATCH] fix DirectoryNotEmpty when it comes to a Non-directory file + +--- + src/core/path.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/path.c b/src/core/path.c +index 29ec66fd4d..bcd922901b 100644 +--- a/src/core/path.c ++++ b/src/core/path.c +@@ -215,7 +215,7 @@ static bool path_spec_check_good(PathSpec *s, bool initial, bool from_trigger_no + int k; + + k = dir_is_empty(s->path); +- good = !(k == -ENOENT || k > 0); ++ good = !(IN_SET(k, -ENOENT, -ENOTDIR) || k > 0); + break; + } + +-- +2.27.0 + diff --git a/systemd.spec b/systemd.spec index a77a46e..9052d4a 100644 --- a/systemd.spec +++ b/systemd.spec @@ -20,7 +20,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 249 -Release: 3 +Release: 4 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -64,6 +64,14 @@ Patch0015: 0015-systemd-change-time-log-level.patch Patch0016: 0016-fix-capsh-drop-but-ping-success.patch Patch0017: 0017-resolved-create-etc-resolv.conf-symlink-at-runtime.patch +#backport +Patch6000: backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch +Patch6001: backport-fix-ConditionDirectoryNotEmpty-when-it-comes-to-a-No.patch +Patch6002: backport-fix-ConditionPathIsReadWrite-when-path-does-not-exis.patch +Patch6003: backport-fix-DirectoryNotEmpty-when-it-comes-to-a-Non-directo.patch + +#openEuler + BuildRequires: gcc, gcc-c++ BuildRequires: libcap-devel, libmount-devel, pam-devel, libselinux-devel BuildRequires: audit-libs-devel, cryptsetup-devel, dbus-devel, libacl-devel @@ -1208,6 +1216,7 @@ fi %{_unitdir}/multi-user.target.wants/systemd-ask-password-wall.path %{_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service %{_unitdir}/systemd-hostnamed.service.d/disable-privatedevices.conf +%{_unitdir}/sockets.target.wants/systemd-coredump.socket %{_unitdir}/sockets.target.wants/systemd-journald-dev-log.socket %{_unitdir}/sockets.target.wants/systemd-journald.socket %{_unitdir}/sockets.target.wants/systemd-initctl.socket @@ -1449,7 +1458,6 @@ fi %{_unitdir}/systemd-udev-trigger.service.d/systemd-udev-trigger-no-reload.conf %{_unitdir}/sockets.target.wants/systemd-udevd-control.socket %{_unitdir}/sockets.target.wants/systemd-udevd-kernel.socket -%{_unitdir}/sockets.target.wants/systemd-coredump.socket %{_systemddir}/system-generators/systemd-cryptsetup-generator %{_systemddir}/system-generators/systemd-hibernate-resume-generator %{_systemddir}/system-generators/systemd-gpt-auto-generator @@ -1697,6 +1705,9 @@ fi %{_unitdir}/systemd-userdbd.socket %changelog +* Tue Feb 8 2021 yangmingtai - 249-4 +- fix ConditionDirectoryNotEmpty,ConditionPathIsReadWrite and DirectoryNotEmpty + * Tue Feb 8 2021 yangmingtai - 249-3 - do not make systemd-cpredump sub packages