From c9a1a57922f43b0c722e0b45109fa9366d6a432c Mon Sep 17 00:00:00 2001 From: Huaxin Lu Date: Wed, 21 Aug 2024 15:02:32 +0800 Subject: [PATCH] fix(dracut-install): copy mode when use clone ioctl --- dracut.spec | 6 +++- ...stall-copy-mode-when-use-clone-ioctl.patch | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 fix-dracut-install-copy-mode-when-use-clone-ioctl.patch diff --git a/dracut.spec b/dracut.spec index 0b54da3..c1bcc64 100644 --- a/dracut.spec +++ b/dracut.spec @@ -9,7 +9,7 @@ Name: dracut Version: 059 -Release: 9 +Release: 10 Summary: Initramfs generator using udev @@ -41,6 +41,7 @@ Patch12: backport-feat-systemd-install-systemd-executor.patch Patch6000: backport-fix-dracut.sh-remove-microcode-check-based-on-CONFIG.patch Patch6001: backport-fix-zfcp_rules-correct-shellcheck-regression-when-pa.patch Patch6003: backport-fix-dracut-install-copy-xattr-when-use-clone-ioctl.patch +Patch6004: fix-dracut-install-copy-mode-when-use-clone-ioctl.patch Patch9000: remove-iscsi-related-code-since-it-is-no-longer-main.patch @@ -531,6 +532,9 @@ rm -f 51-dracut-rescue-postinst.sh %endif %changelog +* Fri Sep 6 2024 luhuaxin - 059-10 +- fix(dracut-install): copy mode when use clone ioctl + * Mon Aug 26 2024 yanshuai - 059-9 - remove iscsi-related code since it is no longer maintained by open-iscsi diff --git a/fix-dracut-install-copy-mode-when-use-clone-ioctl.patch b/fix-dracut-install-copy-mode-when-use-clone-ioctl.patch new file mode 100644 index 0000000..828e571 --- /dev/null +++ b/fix-dracut-install-copy-mode-when-use-clone-ioctl.patch @@ -0,0 +1,31 @@ +From a1c9480ac9791eb961507b44b7c0813a9ffd4ca4 Mon Sep 17 00:00:00 2001 +From: Huaxin Lu +Date: Wed, 21 Aug 2024 14:51:53 +0800 +Subject: [PATCH] fix(dracut-install): copy mode when use clone ioctl + +When use clone ioctl to copy a file, the mode of files are missing, +which is inconsistent with the result by using the cp command. +This commit add the process to set mode after clone_file(). + +Signed-off-by: Huaxin Lu +--- + src/install/dracut-install.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c +index 291c70a..47b799e 100644 +--- a/src/install/dracut-install.c ++++ b/src/install/dracut-install.c +@@ -363,6 +363,9 @@ static int cp(const char *src, const char *dst) + log_info("Failed to chown %s: %m", dst); + } + ++ if (fchmod(dest_desc, sb.st_mode) != 0) ++ log_error("Failed to chown %s: %m", dst); ++ + if (geteuid() == 0 && no_xattr == false) { + if (copy_xattr(dest_desc, source_desc) != 0) + log_error("Failed to copy xattr %s: %m", dst); +-- +2.33.0 + -- Gitee