iSulad/0109-fix-clang-build-error.patch
2024-09-09 21:20:09 +08:00

332 lines
13 KiB
Diff

From 5729e26c3d57922cfb449cac04eb74d51b5f9c3a Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 30 Aug 2024 01:17:01 +0800
Subject: [PATCH 1/8] move cri_stream_server_url out of extern C in stream_server.h
---
src/daemon/entry/cri/streams/stream_server.h | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/daemon/entry/cri/streams/stream_server.h b/src/daemon/entry/cri/streams/stream_server.h
index 81aa998..9a7fccb 100644
--- a/src/daemon/entry/cri/streams/stream_server.h
+++ b/src/daemon/entry/cri/streams/stream_server.h
@@ -17,6 +17,8 @@
#include "errors.h"
#include "url.h"
+url::URLDatum cri_stream_server_url(void);
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -27,8 +29,6 @@ void cri_stream_server_wait(void);
void cri_stream_server_shutdown(void);
-url::URLDatum cri_stream_server_url(void);
-
#ifdef __cplusplus
}
#endif
--
2.43.0
From c21d5b4ae5fc7d1b1c70cddfc9c52449e99607c8 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 30 Aug 2024 01:33:15 +0800
Subject: [PATCH 2/8] fix unqualified call to 'std::move'
---
src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc | 2 +-
src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.cc | 2 +-
src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc | 4 ++--
src/daemon/entry/cri/v1alpha/cri_container_manager_service.cc | 2 +-
.../entry/cri/v1alpha/cri_image_manager_service_impl.cc | 2 +-
.../entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc | 4 ++--
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
index 1cee68e..86688a1 100644
--- a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
+++ b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
@@ -690,7 +690,7 @@ void ContainerManagerService::ListContainersToGRPC(container_list_response *resp
CRIHelpersV1::ContainerStatusToRuntime(Container_Status(response->containers[i]->status));
container->set_state(state);
- containers.push_back(move(container));
+ containers.push_back(std::move(container));
}
}
diff --git a/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.cc b/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.cc
index 7191870..561a40d 100644
--- a/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.cc
+++ b/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.cc
@@ -149,7 +149,7 @@ void ImageManagerServiceImpl::list_images_to_grpc(im_list_response *response,
imagetool_image_summary *element = list_images->images[i];
conv_image_to_grpc(element, image);
- images.push_back(move(image));
+ images.push_back(std::move(image));
}
}
diff --git a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
index fa726e2..f929e0e 100644
--- a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
+++ b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
@@ -1170,7 +1170,7 @@ void PodSandboxManagerService::PodSandboxStatsToGRPC(const std::string &id, cons
return;
}
- podStats = move(podStatsPtr);
+ podStats = std::move(podStatsPtr);
return;
}
@@ -1320,7 +1320,7 @@ void PodSandboxManagerService::ListPodSandboxStats(const runtime::v1::PodSandbox
continue;
}
- podsStats.push_back(move(podStats));
+ podsStats.push_back(std::move(podStats));
}
}
diff --git a/src/daemon/entry/cri/v1alpha/cri_container_manager_service.cc b/src/daemon/entry/cri/v1alpha/cri_container_manager_service.cc
index dbefa14..97acecd 100644
--- a/src/daemon/entry/cri/v1alpha/cri_container_manager_service.cc
+++ b/src/daemon/entry/cri/v1alpha/cri_container_manager_service.cc
@@ -687,7 +687,7 @@ void ContainerManagerService::ListContainersToGRPC(container_list_response *resp
CRIHelpersV1Alpha::ContainerStatusToRuntime(Container_Status(response->containers[i]->status));
container->set_state(state);
- pods.push_back(move(container));
+ pods.push_back(std::move(container));
}
}
diff --git a/src/daemon/entry/cri/v1alpha/cri_image_manager_service_impl.cc b/src/daemon/entry/cri/v1alpha/cri_image_manager_service_impl.cc
index cf63642..a14dc62 100644
--- a/src/daemon/entry/cri/v1alpha/cri_image_manager_service_impl.cc
+++ b/src/daemon/entry/cri/v1alpha/cri_image_manager_service_impl.cc
@@ -149,7 +149,7 @@ void ImageManagerServiceImpl::list_images_to_grpc(im_list_response *response,
imagetool_image_summary *element = list_images->images[i];
conv_image_to_grpc(element, image);
- images.push_back(move(image));
+ images.push_back(std::move(image));
}
}
diff --git a/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
index bc3f403..591f74a 100644
--- a/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
+++ b/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
@@ -1561,7 +1561,7 @@ void PodSandboxManagerService::PodSandboxStatsToGRPC(const std::string &id, cons
return;
}
- podStats = move(podStatsPtr);
+ podStats = std::move(podStatsPtr);
return;
}
@@ -1721,7 +1721,7 @@ void PodSandboxManagerService::ListPodSandboxStats(const runtime::v1alpha2::PodS
continue;
}
- podsStats.push_back(move(podStats));
+ podsStats.push_back(std::move(podStats));
}
}
--
2.43.0
From 8d8ee818c0a557db793e5c9660594a08f7e6a09f Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 30 Aug 2024 01:34:49 +0800
Subject: [PATCH 3/8] fix 'format string is not a string literal (potentially
insecure)'
---
src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
index f929e0e..7cae705 100644
--- a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
+++ b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
@@ -505,7 +505,7 @@ auto PodSandboxManagerService::GetContainerListResponse(const std::string &readS
if (CRIHelpers::FiltersAddLabel(list_request->filters, CRIHelpers::Constants::SANDBOX_ID_LABEL_KEY,
readSandboxID) != 0) {
std::string tmp_errmsg = "Failed to add label in sandbox" + readSandboxID;
- ERROR(tmp_errmsg.c_str());
+ ERROR("%s", tmp_errmsg.c_str());
errors.push_back(tmp_errmsg);
return nullptr;
}
@@ -520,7 +520,7 @@ auto PodSandboxManagerService::GetContainerListResponse(const std::string &readS
}
if (ret != 0) {
if (list_response != nullptr && list_response->errmsg != nullptr) {
- ERROR(list_response->errmsg);
+ ERROR("%s", list_response->errmsg);
errors.push_back(list_response->errmsg);
} else {
ERROR("Failed to call list container callback");
--
2.43.0
From 483064dbb18a7febea53d5558cbd633d4845279b Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 30 Aug 2024 01:35:58 +0800
Subject: [PATCH 4/8] fix braces around initialization of subobject
---
src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc | 2 +-
src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
index 7cae705..9240894 100644
--- a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
+++ b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
@@ -1179,7 +1179,7 @@ auto PodSandboxManagerService::PodSandboxStats(const std::string &podSandboxID,
Errors &error) -> std::unique_ptr<runtime::v1::PodSandboxStats>
{
Errors tmpErr;
- cgroup_metrics_t cgroupMetrics { 0 };
+ cgroup_metrics_t cgroupMetrics {{ 0 }};
std::vector<Network::NetworkInterfaceStats> netMetrics;
std::map<std::string, std::string> annotations;
std::unique_ptr<runtime::v1::PodSandboxStats> podStats { nullptr };
diff --git a/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
index 591f74a..b71e3fc 100644
--- a/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
+++ b/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
@@ -1571,7 +1571,7 @@ auto PodSandboxManagerService::PodSandboxStats(const std::string &podSandboxID,
{
Errors tmpErr;
container_inspect *inspectData { nullptr };
- cgroup_metrics_t cgroupMetrics { 0 };
+ cgroup_metrics_t cgroupMetrics {{ 0 }};
std::vector<Network::NetworkInterfaceStats> netMetrics;
std::map<std::string, std::string> annotations;
std::unique_ptr<runtime::v1alpha2::PodSandboxStats> podStats { nullptr };
--
2.43.0
From cb19526803a2ad5d60a6dee7e6b32998cc75fc10 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 30 Aug 2024 01:37:07 +0800
Subject: [PATCH 5/8] fix 'private field 'm_enablePodEvents' is not used'
---
src/daemon/entry/cri/v1/v1_cri_runtime_service_impl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/daemon/entry/cri/v1/v1_cri_runtime_service_impl.h b/src/daemon/entry/cri/v1/v1_cri_runtime_service_impl.h
index 3d93c7b..9be378f 100644
--- a/src/daemon/entry/cri/v1/v1_cri_runtime_service_impl.h
+++ b/src/daemon/entry/cri/v1/v1_cri_runtime_service_impl.h
@@ -104,7 +104,7 @@ protected:
private:
std::string m_podSandboxImage;
std::shared_ptr<Network::PluginManager> m_pluginManager { nullptr };
- bool m_enablePodEvents;
+ [[maybe_unused]]bool m_enablePodEvents;
};
} // namespace CRIV1
#endif // DAEMON_ENTRY_CRI_V1_CRI_RUNTIME_SERVICE_IMPL_H
--
2.43.0
From d8205b06e3cf58104d02bb153a202a512869e293 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 30 Aug 2024 01:44:15 +0800
Subject: [PATCH 6/8] fix passing std::string to variadic functions
---
src/daemon/common/cri/cri_helpers.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/daemon/common/cri/cri_helpers.cc b/src/daemon/common/cri/cri_helpers.cc
index 8117403..a8cbd99 100644
--- a/src/daemon/common/cri/cri_helpers.cc
+++ b/src/daemon/common/cri/cri_helpers.cc
@@ -525,8 +525,8 @@ void RemoveContainerLogSymlink(const std::string &containerID, Errors &error)
if (!path.empty()) {
// Only remove the symlink when container log path is specified.
if (util_path_remove(path.c_str()) != 0 && errno != ENOENT) {
- SYSERROR("Failed to remove container %s log symlink %s.", containerID.c_str(), path);
- error.Errorf("Failed to remove container %s log symlink %s.", containerID.c_str(), path);
+ SYSERROR("Failed to remove container %s log symlink %s.", containerID.c_str(), path.c_str());
+ error.Errorf("Failed to remove container %s log symlink %s.", containerID.c_str(), path.c_str());
}
}
}
--
2.43.0
From 5ec6bd878249177f15bee5c7c43b6668fbf672f1 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 30 Aug 2024 01:44:24 +0800
Subject: [PATCH 7/8] remove unnecessary std::move for std::unique_ptr
initialization
---
src/daemon/sandbox/sandbox_ops.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/daemon/sandbox/sandbox_ops.cc b/src/daemon/sandbox/sandbox_ops.cc
index b7fb40b..22cfea9 100644
--- a/src/daemon/sandbox/sandbox_ops.cc
+++ b/src/daemon/sandbox/sandbox_ops.cc
@@ -72,7 +72,7 @@ static int do_sandbox_prepare(const container_config_v2_common_config *config,
params.containerId = config->id;
params.execId = (nullptr == exec_id) ? "" : exec_id;
- params.spec = std::move(std::unique_ptr<std::string>(new std::string(oci_spec)));
+ params.spec = std::unique_ptr<std::string>(new std::string(oci_spec));
if (generate_ctrl_rootfs(params, config) != 0) {
ERROR("Invalid rootfs");
--
2.43.0
From b3cdeb691b67e733d48254b8685c35a5fe450e78 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 30 Aug 2024 01:44:32 +0800
Subject: [PATCH 8/8] fix more '%' conversions than data arguments
---
src/daemon/sandbox/sandbox.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/daemon/sandbox/sandbox.cc b/src/daemon/sandbox/sandbox.cc
index d44abb9..dec082b 100644
--- a/src/daemon/sandbox/sandbox.cc
+++ b/src/daemon/sandbox/sandbox.cc
@@ -847,7 +847,7 @@ auto Sandbox::SaveState(Errors &error) -> bool
nret = util_atomic_write_file(path.c_str(), stateJson.c_str(), stateJson.length(), CONFIG_FILE_MODE, false);
if (nret != 0) {
- SYSERROR("Failed to write file %s");
+ SYSERROR("Failed to write file %s", path.c_str());
error.Errorf("Failed to write file %s", path.c_str());
return false;
}
--
2.43.0