代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/python-rtslib 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From b23d061ee0fa7924d2cdce6194c313b9ee06c468 Mon Sep 17 00:00:00 2001
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Date: Thu, 28 May 2020 20:42:16 +0530
Subject: [PATCH] saveconfig: copy temp configfile with permissions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
shutil.copyfile() will not copy permissions, so all the perms that we
set on tempfile will go for a toss, and will be reset to default
┌──────────────────┬────────┬───────────┬───────┬────────────────┐
│ Function │ Copies │ Copies │Can use│ Destination │
│ │metadata│permissions│buffer │may be directory│
├──────────────────┼────────┼───────────┼───────┼────────────────┤
│shutil.copy │ No │ Yes │ No │ Yes │
│shutil.copyfile │ No │ No │ No │ No │
│shutil.copy2 │ Yes │ Yes │ No │ Yes │
│shutil.copyfileobj│ No │ No │ Yes │ No │
└──────────────────┴────────┴───────────┴───────┴────────────────┘
Without this fix:
----------------
$ ls /etc/target/saveconfig.json -l
-rw-r--r-- 1 root root 5078 May 28 20:01 /etc/target/saveconfig.json
With this fix:
--------------
$ ls /etc/target/saveconfig.json -l
-rw------- 1 root root 5078 May 28 20:15 /etc/target/saveconfig.json
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
---
rtslib/root.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rtslib/root.py b/rtslib/root.py
index a101edd..7364154 100644
--- a/rtslib/root.py
+++ b/rtslib/root.py
@@ -486,7 +486,8 @@ class RTSRoot(CFSNode):
os.fsync(f.fileno())
f.close()
- shutil.copyfile(tmp_file, save_file)
+ # copy along with permissions
+ shutil.copy(tmp_file, save_file)
os.remove(tmp_file)
def restore_from_file(self, restore_file=None, clear_existing=True,
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。