!139 libnetwork: fix non-constant format string in call (govet)

From: @dog-life 
Reviewed-by: @xu_lei_123 
Signed-off-by: @xu_lei_123
This commit is contained in:
openeuler-ci-bot 2025-04-20 11:03:25 +00:00 committed by Gitee
commit c5e564a4dc
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,62 @@
From 81053917083b7776ec39172823f7a4f954363ec1 Mon Sep 17 00:00:00 2001
From: Sebastiaan van Stijn <github@gone.nl>
Date: Wed, 21 Aug 2024 15:38:52 +0200
Subject: [PATCH 107/172] libnetwork: fix non-constant format string in call
(govet)
libnetwork/controller.go:1054:32: printf: non-constant format string in call to github.com/docker/docker/libnetwork/types.NotFoundErrorf (govet)
return types.NotFoundErrorf(err.Error())
^
libnetwork/controller.go:1073:32: printf: non-constant format string in call to github.com/docker/docker/libnetwork/types.NotFoundErrorf (govet)
return types.NotFoundErrorf(err.Error())
^
libnetwork/sandbox_externalkey_unix.go:113:21: printf: non-constant format string in call to fmt.Errorf (govet)
return fmt.Errorf(string(buf[0:n]))
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6008c42ca2903467964c430c0030a29ae4cc858e)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
---
libnetwork/controller.go | 4 ++--
libnetwork/sandbox_externalkey_unix.go | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libnetwork/controller.go b/libnetwork/controller.go
index bcbbdd06ca..8341946756 100644
--- a/libnetwork/controller.go
+++ b/libnetwork/controller.go
@@ -1045,7 +1045,7 @@ func (c *Controller) loadDriver(networkType string) error {
if err != nil {
if errors.Cause(err) == plugins.ErrNotFound {
- return types.NotFoundErrorf(err.Error())
+ return types.NotFoundErrorf("%v", err)
}
return err
}
@@ -1064,7 +1064,7 @@ func (c *Controller) loadIPAMDriver(name string) error {
if err != nil {
if errors.Cause(err) == plugins.ErrNotFound {
- return types.NotFoundErrorf(err.Error())
+ return types.NotFoundErrorf("%v", err)
}
return err
}
diff --git a/libnetwork/sandbox_externalkey_unix.go b/libnetwork/sandbox_externalkey_unix.go
index 7534421141..32b1027bb4 100644
--- a/libnetwork/sandbox_externalkey_unix.go
+++ b/libnetwork/sandbox_externalkey_unix.go
@@ -94,7 +94,7 @@ func processReturn(r io.Reader) error {
return fmt.Errorf("failed to read buf in processReturn : %v", err)
}
if string(buf[0:n]) != success {
- return fmt.Errorf(string(buf[0:n]))
+ return fmt.Errorf("%s", buf[0:n])
}
return nil
}
--
2.27.0

View File

@ -7,7 +7,7 @@
Name: moby
Version: 25.0.3
Release: 28
Release: 29
Summary: The open-source application container engine
License: Apache-2.0
URL: https://www.docker.com
@ -40,6 +40,7 @@ Patch1013: 1013-Don-t-enforce-new-validation-rules-for-existing-netw.patch
Patch1014: 1014-daemon-overlay2-remove-world-writable-permission-fro.patch
Patch1015: 1015-rootless-fix-open-etc-docker-plugins-permission-deni.patch
Patch1016: 1016-Fix-cases-where-we-are-wrapping-a-nil-error.patch
Patch1017: 1017-libnetwork-fix-non-constant-format-string-in-call-go.patch
# Patch 2001-2999 for tini
Patch2001: 2001-tini.c-a-function-declaration-without-a-prototype-is.patch
Requires(meta): %{name}-engine = %{version}-%{release}
@ -231,6 +232,9 @@ fi
%systemd_postun_with_restart docker.service
%changelog
* Sun Apr 20 2025 shechenglong <shechenglong@xfusion.com> - 25.0.3-29
- libnetwork: fix non-constant format string in call (govet)
* Sat Apr 19 2025 shechenglong <shechenglong@xfusion.com> - 25.0.3-28
- rootless: Fix cases where we are wrapping a nil error