From 9ef73b6ad08c19c3906564e5a15c7908ed9a81c8 Mon Sep 17 00:00:00 2001 From: Antonio Alvarez Feijoo Date: Mon, 4 Apr 2022 11:55:59 +0200 Subject: [PATCH] fix(dracut-install): copy files preserving ownership attributes While the "clone copy" operation changes the ownership of the cloned files, the "normal copy" using cp does not preserve it. Reference:https://github.com/dracutdevs/dracut/commit/9ef73b6ad08c19c3906564e5a15c7908ed9a81c8 Conflict:NA --- src/install/dracut-install.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c index d7a1cd9b..7c6d91c1 100644 --- a/src/install/dracut-install.c +++ b/src/install/dracut-install.c @@ -327,10 +327,10 @@ normal_copy: pid = fork(); if (pid == 0) { if (geteuid() == 0 && no_xattr == false) - execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,xattr,timestamps", "-fL", + execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,xattr,timestamps,ownership", "-fL", src, dst, NULL); else - execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, + execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps,ownership", "-fL", src, dst, NULL); _exit(EXIT_FAILURE); } @@ -339,10 +339,10 @@ normal_copy: if (errno != EINTR) { ret = -1; if (geteuid() == 0 && no_xattr == false) - log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,xattr,timestamps -fL %s %s", + log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,xattr,timestamps,ownership -fL %s %s", src, dst); else - log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", + log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps,ownership -fL %s %s", src, dst); break; } -- 2.23.0