From: Antonio Alvarez Feijoo Date: Mon, 4 Apr 2022 09:55:59 +0000 (+0200) Subject: fix(dracut-install): copy files preserving ownership attributes X-Git-Tag: 057~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ef73b6ad08c19c3906564e5a15c7908ed9a81c8;p=thirdparty%2Fdracut.git 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. --- diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c index d7a1cd9b6..7c6d91c15 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; }