- Avoid "Failed to chown ... Operation not permitted" when run from non-root,

by not copying xattrs. (osc#1092178)
  * adds 0593-dracut-only-copy-xattr-if-root.patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=366
This commit is contained in:
Daniel Molkentin 2019-02-18 13:32:24 +00:00 committed by Git OBS Bridge
parent c40d0441ae
commit 8532cba494
3 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,33 @@
From 97b36b154ce40f91b1c73a610c796965a569b637 Mon Sep 17 00:00:00 2001
From: Daniel Molkentin <dmolkentin@suse.com>
Date: Mon, 18 Feb 2019 14:21:05 +0100
Subject: [PATCH] dracut: only copy xattr, if root
(Cherry-picked from 076fcd1652af25f57aae063fda3b8c39ef828ac6)
---
install/dracut-install.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/install/dracut-install.c b/install/dracut-install.c
index a7bfdb8c..381327c2 100644
--- a/install/dracut-install.c
+++ b/install/dracut-install.c
@@ -222,8 +222,13 @@ static int cp(const char *src, const char *dst)
if (ret == 0) {
struct timeval tv[2];
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
- if(fchown(dest_desc, (uid_t) - 1, sb.st_gid) != 0)
- log_error("Failed to chown %s: %m", dst);
+ if(fchown(dest_desc, (uid_t) - 1, sb.st_gid) != 0) {
+ if (geteuid() == 0)
+ log_error("Failed to chown %s: %m", dst);
+ else
+ log_info("Failed to chown %s: %m", dst);
+ }
+
tv[0].tv_sec = sb.st_atime;
tv[0].tv_usec = 0;
tv[1].tv_sec = sb.st_mtime;
--
2.16.4

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Feb 15 17:23:11 UTC 2019 - Daniel Molkentin <daniel.molkentin@suse.com>
- Avoid "Failed to chown ... Operation not permitted" when run from non-root,
by not copying xattrs. (osc#1092178)
* adds 0593-dracut-only-copy-xattr-if-root.patch
-------------------------------------------------------------------
Tue Feb 12 16:38:21 UTC 2019 - Daniel Molkentin <daniel.molkentin@suse.com>

View File

@ -429,6 +429,8 @@ Patch590: 0590-00systemd-check-if-systemd-version-is-a-number.patch
Patch591: 0591-91zipl-Don-t-use-contents-of-commented-lines.patch
# Patch submitted to upstream
Patch592: 0592-95iscsi-handle-qedi-like-bnx2i.patch
# Patch adopted from upstream commit e7ba1392e180eb6f5e19dfd28a340a98cf09a3cd
Patch593: 0593-dracut-only-copy-xattr-if-root.patch
BuildRequires: asciidoc
BuildRequires: bash
@ -739,6 +741,7 @@ chmod a+x modules.d/95qeth_rules/module-setup.sh
%patch590 -p1
%patch591 -p1
%patch592 -p1
%patch593 -p1
%build
%configure\