代码拉取完成,页面将自动刷新
同步操作将从 yangshicheng/systemd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 6ea63e538eaa13e1efacd33e4ade2cd096b818e0 Mon Sep 17 00:00:00 2001
From: Luca Boccassi <luca.boccassi@microsoft.com>
Date: Wed, 18 Aug 2021 16:37:13 +0100
Subject: [PATCH] portabled: error out if there are no units only after parsing
all images
It's ok if the OS image doesn't have matching units, if we find them
in the extensions. Tidies up the parsing logic a bit.
(cherry picked from commit 7bf5ec4538cd4c77979dd9d09d9e9429a0a3535c)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/6ea63e538eaa13e1efacd33e4ade2cd096b818e0
---
src/portable/portable.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/portable/portable.c b/src/portable/portable.c
index 5ecbeec2de..8550becded 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -504,9 +504,6 @@ static int portable_extract_by_path(
if (extract_os_release && !os_release)
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Image '%s' lacks os-release data, refusing.", path);
- if (!extract_os_release && hashmap_isempty(unit_files))
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Couldn't find any matching unit files in image '%s', refusing.", path);
-
if (ret_unit_files)
*ret_unit_files = TAKE_PTR(unit_files);
@@ -573,6 +570,19 @@ int portable_extract(
return r;
}
+ if (hashmap_isempty(unit_files)) {
+ _cleanup_free_ char *extensions = strv_join(extension_image_paths, ", ");
+ if (!extensions)
+ return -ENOMEM;
+
+ return sd_bus_error_setf(error,
+ SD_BUS_ERROR_INVALID_ARGS,
+ "Couldn't find any matching unit files in image '%s%s%s', refusing.",
+ image->path,
+ isempty(extensions) ? "" : "' or any of its extensions '",
+ isempty(extensions) ? "" : extensions);
+ }
+
*ret_os_release = TAKE_PTR(os_release);
*ret_unit_files = TAKE_PTR(unit_files);
@@ -1189,6 +1199,19 @@ int portable_attach(
return r;
}
+ if (hashmap_isempty(unit_files)) {
+ _cleanup_free_ char *extensions = strv_join(extension_image_paths, ", ");
+ if (!extensions)
+ return -ENOMEM;
+
+ return sd_bus_error_setf(error,
+ SD_BUS_ERROR_INVALID_ARGS,
+ "Couldn't find any matching unit files in image '%s%s%s', refusing.",
+ image->path,
+ isempty(extensions) ? "" : "' or any of its extensions '",
+ isempty(extensions) ? "" : extensions);
+ }
+
r = lookup_paths_init(&paths, UNIT_FILE_SYSTEM, LOOKUP_PATHS_SPLIT_USR, NULL);
if (r < 0)
return r;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。