From aeb053c46ed859046de362c974e89a0f9902aede Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Wed, 17 Jan 2024 10:59:20 +0800 Subject: [PATCH 01/11] fix: improve error message for plugin Signed-off-by: Junjie Gao --- cmd/notation/plugin/install.go | 14 ++++++++++++++ cmd/notation/plugin/list.go | 6 ++++++ go.mod | 4 +++- go.sum | 6 ++---- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/cmd/notation/plugin/install.go b/cmd/notation/plugin/install.go index 6f32c7b0f..4b3f70b9e 100644 --- a/cmd/notation/plugin/install.go +++ b/cmd/notation/plugin/install.go @@ -25,6 +25,7 @@ import ( "net/url" "os" "path/filepath" + "runtime" "strings" "github.com/notaryproject/notation-go/dir" @@ -330,6 +331,19 @@ func installPluginWithOptions(ctx context.Context, opts plugin.CLIInstallOptions if errors.As(err, &errPluginDowngrade) { return fmt.Errorf("%w.\nIt is not recommended to install an older version. To force the installation, use the \"--force\" option", errPluginDowngrade) } + + var errExeFile plugin.PluginExecutableFileError + if errors.As(err, &errExeFile) { + var errPath *os.PathError + if errors.As(errExeFile, &errPath) && errPath.Op == "fork/exec" { + return fmt.Errorf("%w.\nPlease ensure the plugin is executable and meet the installation requirements on the %s/%s.", errExeFile, runtime.GOOS, runtime.GOARCH) + } + } + + var errMalformedPlugin *plugin.PluginMalformedError + if errors.As(err, &errMalformedPlugin) { + return fmt.Errorf("%w.\nPlease ensure the installation of the plugin for %s/%s, and make sure that the plugin adheres to the Notation plugin requirements.", errMalformedPlugin, runtime.GOOS, runtime.GOARCH) + } return err } if existingPluginMetadata != nil { diff --git a/cmd/notation/plugin/list.go b/cmd/notation/plugin/list.go index e715ac233..a946cf8e9 100644 --- a/cmd/notation/plugin/list.go +++ b/cmd/notation/plugin/list.go @@ -14,6 +14,7 @@ package plugin import ( + "errors" "fmt" "os" "text/tabwriter" @@ -44,6 +45,11 @@ func listPlugins(command *cobra.Command) error { mgr := plugin.NewCLIManager(dir.PluginFS()) pluginNames, err := mgr.List(command.Context()) if err != nil { + var errPluginDirWalk plugin.PluginDirectoryWalkError + if errors.As(err, &errPluginDirWalk) { + pluginDir, _ := dir.PluginFS().SysPath("") + return fmt.Errorf("%w.\nPlease check if the current user has access to the plugin directory: %s", errPluginDirWalk, pluginDir) + } return err } diff --git a/go.mod b/go.mod index 4d6690e1a..ec63dc1d4 100644 --- a/go.mod +++ b/go.mod @@ -25,8 +25,10 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/veraison/go-cose v1.1.0 // indirect github.com/x448/float16 v0.8.4 // indirect - golang.org/x/crypto v0.17.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/mod v0.14.0 // indirect golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.16.0 // indirect ) + +replace github.com/notaryproject/notation-go => ../notation-go diff --git a/go.sum b/go.sum index 61c9d5122..8fa5a2aef 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,6 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/notaryproject/notation-core-go v1.0.1 h1:01doxjDERbd0vocLQrlJdusKrRLNNn50OJzp0c5I4Cw= github.com/notaryproject/notation-core-go v1.0.1/go.mod h1:rayl8WlKgS4YxOZgDO0iGGB4Ef515ZFZUFaZDmsPXgE= -github.com/notaryproject/notation-go v1.0.2-0.20240112021749-b315de42f912 h1:7abHy5FOfA4mq47/+0pIg/vjI2xfj9qH6cQ47Vc3arM= -github.com/notaryproject/notation-go v1.0.2-0.20240112021749-b315de42f912/go.mod h1:Sj9N0ZRdwIEHL8ewzMjKFEIcLCJhp0r8h6IoT48Q/8E= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= @@ -51,8 +49,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= From b8b91bd04ce911d679ad9c7188b512f041d881c4 Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 18 Jan 2024 10:03:42 +0800 Subject: [PATCH 02/11] build: bump up notation-go Signed-off-by: Junjie Gao --- go.mod | 4 +--- go.sum | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ec63dc1d4..9ad16cbce 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/notaryproject/notation-core-go v1.0.1 - github.com/notaryproject/notation-go v1.0.2-0.20240112021749-b315de42f912 + github.com/notaryproject/notation-go v1.0.2-0.20240118012419-d52ca7162a49 github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.1.0-rc5 github.com/oras-project/oras-credentials-go v0.3.1 @@ -30,5 +30,3 @@ require ( golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.16.0 // indirect ) - -replace github.com/notaryproject/notation-go => ../notation-go diff --git a/go.sum b/go.sum index 8fa5a2aef..779e36b14 100644 --- a/go.sum +++ b/go.sum @@ -20,6 +20,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/notaryproject/notation-core-go v1.0.1 h1:01doxjDERbd0vocLQrlJdusKrRLNNn50OJzp0c5I4Cw= github.com/notaryproject/notation-core-go v1.0.1/go.mod h1:rayl8WlKgS4YxOZgDO0iGGB4Ef515ZFZUFaZDmsPXgE= +github.com/notaryproject/notation-go v1.0.2-0.20240118012419-d52ca7162a49 h1:wegIBQUMjD/o7bNxx7ifvH2G/gclnnYnXZSvFPuSgn4= +github.com/notaryproject/notation-go v1.0.2-0.20240118012419-d52ca7162a49/go.mod h1:/ddbxt03OnWzfb/jZD6STe/gbuWhFaYLWCkq1BkgUCQ= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= From 75cf1925769adb119587738122d310980a45adbc Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 18 Jan 2024 12:53:43 +0800 Subject: [PATCH 03/11] fix: hide fork/exec Signed-off-by: Junjie Gao --- cmd/notation/plugin/install.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/notation/plugin/install.go b/cmd/notation/plugin/install.go index 4b3f70b9e..298827a32 100644 --- a/cmd/notation/plugin/install.go +++ b/cmd/notation/plugin/install.go @@ -336,7 +336,11 @@ func installPluginWithOptions(ctx context.Context, opts plugin.CLIInstallOptions if errors.As(err, &errExeFile) { var errPath *os.PathError if errors.As(errExeFile, &errPath) && errPath.Op == "fork/exec" { - return fmt.Errorf("%w.\nPlease ensure the plugin is executable and meet the installation requirements on the %s/%s.", errExeFile, runtime.GOOS, runtime.GOARCH) + return fmt.Errorf("%s.\nPlease ensure the plugin is executable and meet the installation requirements on the %s/%s.", + // hide the wrapped error message to simplify the output + strings.TrimSuffix(strings.Split(errExeFile.Error(), "fork/exec")[0], ": "), + runtime.GOOS, + runtime.GOARCH) } } From aea7f51c65611c40f656e23030876303f4d1157f Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 18 Jan 2024 15:24:44 +0800 Subject: [PATCH 04/11] fix: update error message Signed-off-by: Junjie Gao --- cmd/notation/plugin/install.go | 11 ++--------- go.mod | 2 ++ go.sum | 2 -- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/cmd/notation/plugin/install.go b/cmd/notation/plugin/install.go index 298827a32..9fc71e53e 100644 --- a/cmd/notation/plugin/install.go +++ b/cmd/notation/plugin/install.go @@ -332,16 +332,9 @@ func installPluginWithOptions(ctx context.Context, opts plugin.CLIInstallOptions return fmt.Errorf("%w.\nIt is not recommended to install an older version. To force the installation, use the \"--force\" option", errPluginDowngrade) } - var errExeFile plugin.PluginExecutableFileError + var errExeFile *plugin.PluginExecutableFileError if errors.As(err, &errExeFile) { - var errPath *os.PathError - if errors.As(errExeFile, &errPath) && errPath.Op == "fork/exec" { - return fmt.Errorf("%s.\nPlease ensure the plugin is executable and meet the installation requirements on the %s/%s.", - // hide the wrapped error message to simplify the output - strings.TrimSuffix(strings.Split(errExeFile.Error(), "fork/exec")[0], ": "), - runtime.GOOS, - runtime.GOARCH) - } + return fmt.Errorf("%s.\nPlease ensure the plugin is executable on the %s/%s.", errExeFile, runtime.GOOS, runtime.GOARCH) } var errMalformedPlugin *plugin.PluginMalformedError diff --git a/go.mod b/go.mod index 9ad16cbce..209f470df 100644 --- a/go.mod +++ b/go.mod @@ -30,3 +30,5 @@ require ( golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.16.0 // indirect ) + +replace github.com/notaryproject/notation-go => ../notation-go diff --git a/go.sum b/go.sum index 779e36b14..8fa5a2aef 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,6 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/notaryproject/notation-core-go v1.0.1 h1:01doxjDERbd0vocLQrlJdusKrRLNNn50OJzp0c5I4Cw= github.com/notaryproject/notation-core-go v1.0.1/go.mod h1:rayl8WlKgS4YxOZgDO0iGGB4Ef515ZFZUFaZDmsPXgE= -github.com/notaryproject/notation-go v1.0.2-0.20240118012419-d52ca7162a49 h1:wegIBQUMjD/o7bNxx7ifvH2G/gclnnYnXZSvFPuSgn4= -github.com/notaryproject/notation-go v1.0.2-0.20240118012419-d52ca7162a49/go.mod h1:/ddbxt03OnWzfb/jZD6STe/gbuWhFaYLWCkq1BkgUCQ= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= From 807a4c3188efa6884b2f1d9cec67d4f018f07a5a Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 18 Jan 2024 15:27:06 +0800 Subject: [PATCH 05/11] fix: update Signed-off-by: Junjie Gao --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 209f470df..4e1cccbea 100644 --- a/go.mod +++ b/go.mod @@ -31,4 +31,4 @@ require ( golang.org/x/sys v0.16.0 // indirect ) -replace github.com/notaryproject/notation-go => ../notation-go +replace github.com/notaryproject/notation-go => github.com/notaryproject/notation-go v1.0.2-0.20240118012419-d52ca7162a49 v1.0.0-rc.6.0.20240118060847-73d28729ce20 From 45ced97d6f15a97e3a4ac9c1c54c517e70e23721 Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 18 Jan 2024 15:32:15 +0800 Subject: [PATCH 06/11] fix: update go mod Signed-off-by: Junjie Gao --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4e1cccbea..50c49ddd0 100644 --- a/go.mod +++ b/go.mod @@ -31,4 +31,4 @@ require ( golang.org/x/sys v0.16.0 // indirect ) -replace github.com/notaryproject/notation-go => github.com/notaryproject/notation-go v1.0.2-0.20240118012419-d52ca7162a49 v1.0.0-rc.6.0.20240118060847-73d28729ce20 +replace github.com/notaryproject/notation-go => github.com/JeyJeyGao/notation-go v1.0.0-rc.6.0.20240118060847-73d28729ce20 diff --git a/go.sum b/go.sum index 8fa5a2aef..77a0e4427 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8= github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= +github.com/JeyJeyGao/notation-go v1.0.0-rc.6.0.20240118060847-73d28729ce20 h1:+OxueSitwXs2a9zKBLP6feLTPNmPt4xwdXaktfSDjz4= +github.com/JeyJeyGao/notation-go v1.0.0-rc.6.0.20240118060847-73d28729ce20/go.mod h1:/ddbxt03OnWzfb/jZD6STe/gbuWhFaYLWCkq1BkgUCQ= github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 h1:Kk6a4nehpJ3UuJRqlA3JxYxBZEqCeOmATOvrbT4p9RA= github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= From 5dce613bb3b942c79d63278dec6fc045bbc89866 Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 18 Jan 2024 15:38:51 +0800 Subject: [PATCH 07/11] fix: update error message Signed-off-by: Junjie Gao --- cmd/notation/plugin/install.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/notation/plugin/install.go b/cmd/notation/plugin/install.go index 9fc71e53e..6a85f6fba 100644 --- a/cmd/notation/plugin/install.go +++ b/cmd/notation/plugin/install.go @@ -334,12 +334,12 @@ func installPluginWithOptions(ctx context.Context, opts plugin.CLIInstallOptions var errExeFile *plugin.PluginExecutableFileError if errors.As(err, &errExeFile) { - return fmt.Errorf("%s.\nPlease ensure the plugin is executable on the %s/%s.", errExeFile, runtime.GOOS, runtime.GOARCH) + return fmt.Errorf("%s.\nPlease ensure the plugin is executable on %s/%s.", errExeFile, runtime.GOOS, runtime.GOARCH) } var errMalformedPlugin *plugin.PluginMalformedError if errors.As(err, &errMalformedPlugin) { - return fmt.Errorf("%w.\nPlease ensure the installation of the plugin for %s/%s, and make sure that the plugin adheres to the Notation plugin requirements.", errMalformedPlugin, runtime.GOOS, runtime.GOARCH) + return fmt.Errorf("%w.\nPlease ensure to install the plugin for %s/%s. Contact the plugin publisher if the plugin executable file is malformed.", errMalformedPlugin, runtime.GOOS, runtime.GOARCH) } return err } From 5c4d737c3d05fb37263132fca530e87fbfdae4d4 Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 18 Jan 2024 15:49:25 +0800 Subject: [PATCH 08/11] fix: update error message Signed-off-by: Junjie Gao --- cmd/notation/plugin/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/notation/plugin/install.go b/cmd/notation/plugin/install.go index 6a85f6fba..ca60083f5 100644 --- a/cmd/notation/plugin/install.go +++ b/cmd/notation/plugin/install.go @@ -334,7 +334,7 @@ func installPluginWithOptions(ctx context.Context, opts plugin.CLIInstallOptions var errExeFile *plugin.PluginExecutableFileError if errors.As(err, &errExeFile) { - return fmt.Errorf("%s.\nPlease ensure the plugin is executable on %s/%s.", errExeFile, runtime.GOOS, runtime.GOARCH) + return fmt.Errorf("%w.\nPlease ensure the plugin is executable on %s/%s.", err, runtime.GOOS, runtime.GOARCH) } var errMalformedPlugin *plugin.PluginMalformedError From 30f11988f5788c977e154bd39c3ed3c6c57cd1a0 Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Thu, 18 Jan 2024 17:55:08 +0800 Subject: [PATCH 09/11] build: bump up Signed-off-by: Junjie Gao --- go.mod | 4 +--- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 50c49ddd0..29464b47f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/notaryproject/notation-core-go v1.0.1 - github.com/notaryproject/notation-go v1.0.2-0.20240118012419-d52ca7162a49 + github.com/notaryproject/notation-go v1.0.2-0.20240118131949-690448ee6711 github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.1.0-rc5 github.com/oras-project/oras-credentials-go v0.3.1 @@ -30,5 +30,3 @@ require ( golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.16.0 // indirect ) - -replace github.com/notaryproject/notation-go => github.com/JeyJeyGao/notation-go v1.0.0-rc.6.0.20240118060847-73d28729ce20 diff --git a/go.sum b/go.sum index 77a0e4427..80dac5c17 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8= github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= -github.com/JeyJeyGao/notation-go v1.0.0-rc.6.0.20240118060847-73d28729ce20 h1:+OxueSitwXs2a9zKBLP6feLTPNmPt4xwdXaktfSDjz4= -github.com/JeyJeyGao/notation-go v1.0.0-rc.6.0.20240118060847-73d28729ce20/go.mod h1:/ddbxt03OnWzfb/jZD6STe/gbuWhFaYLWCkq1BkgUCQ= github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 h1:Kk6a4nehpJ3UuJRqlA3JxYxBZEqCeOmATOvrbT4p9RA= github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -22,6 +20,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/notaryproject/notation-core-go v1.0.1 h1:01doxjDERbd0vocLQrlJdusKrRLNNn50OJzp0c5I4Cw= github.com/notaryproject/notation-core-go v1.0.1/go.mod h1:rayl8WlKgS4YxOZgDO0iGGB4Ef515ZFZUFaZDmsPXgE= +github.com/notaryproject/notation-go v1.0.2-0.20240118131949-690448ee6711 h1:3mUupkKwYtGj1vRvuyI5q9X69BdQ2mdQk281MbfznJI= +github.com/notaryproject/notation-go v1.0.2-0.20240118131949-690448ee6711/go.mod h1:/ddbxt03OnWzfb/jZD6STe/gbuWhFaYLWCkq1BkgUCQ= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= From 29351b450312ea6bf9c00f08a0f6b61537e21c56 Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Fri, 19 Jan 2024 09:49:06 +0800 Subject: [PATCH 10/11] fix: update error message Signed-off-by: Junjie Gao --- cmd/notation/plugin/install.go | 4 ++-- cmd/notation/plugin/list.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/notation/plugin/install.go b/cmd/notation/plugin/install.go index ca60083f5..8b43e50c1 100644 --- a/cmd/notation/plugin/install.go +++ b/cmd/notation/plugin/install.go @@ -334,12 +334,12 @@ func installPluginWithOptions(ctx context.Context, opts plugin.CLIInstallOptions var errExeFile *plugin.PluginExecutableFileError if errors.As(err, &errExeFile) { - return fmt.Errorf("%w.\nPlease ensure the plugin is executable on %s/%s.", err, runtime.GOOS, runtime.GOARCH) + return fmt.Errorf("%w.\nPlease ensure that the plugin executable is compatible with the %s/%s architecture and has the appropriate file permissions.", err, runtime.GOOS, runtime.GOARCH) } var errMalformedPlugin *plugin.PluginMalformedError if errors.As(err, &errMalformedPlugin) { - return fmt.Errorf("%w.\nPlease ensure to install the plugin for %s/%s. Contact the plugin publisher if the plugin executable file is malformed.", errMalformedPlugin, runtime.GOOS, runtime.GOARCH) + return fmt.Errorf("%w.\nPlease ensure that the plugin executable file is intact and compatible with %s/%s. Contact the plugin publisher for further assistance.", errMalformedPlugin, runtime.GOOS, runtime.GOARCH) } return err } diff --git a/cmd/notation/plugin/list.go b/cmd/notation/plugin/list.go index a946cf8e9..bfc3ebffe 100644 --- a/cmd/notation/plugin/list.go +++ b/cmd/notation/plugin/list.go @@ -48,7 +48,7 @@ func listPlugins(command *cobra.Command) error { var errPluginDirWalk plugin.PluginDirectoryWalkError if errors.As(err, &errPluginDirWalk) { pluginDir, _ := dir.PluginFS().SysPath("") - return fmt.Errorf("%w.\nPlease check if the current user has access to the plugin directory: %s", errPluginDirWalk, pluginDir) + return fmt.Errorf("%w.\nPlease ensure that the current user has permission to access the plugin directory: %s", errPluginDirWalk, pluginDir) } return err } From b2e8418e89081dce622432be0b741b1c638e7163 Mon Sep 17 00:00:00 2001 From: Junjie Gao Date: Fri, 19 Jan 2024 10:14:35 +0800 Subject: [PATCH 11/11] fix: update error message Signed-off-by: Junjie Gao --- cmd/notation/plugin/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/notation/plugin/install.go b/cmd/notation/plugin/install.go index 8b43e50c1..b7538fc16 100644 --- a/cmd/notation/plugin/install.go +++ b/cmd/notation/plugin/install.go @@ -334,7 +334,7 @@ func installPluginWithOptions(ctx context.Context, opts plugin.CLIInstallOptions var errExeFile *plugin.PluginExecutableFileError if errors.As(err, &errExeFile) { - return fmt.Errorf("%w.\nPlease ensure that the plugin executable is compatible with the %s/%s architecture and has the appropriate file permissions.", err, runtime.GOOS, runtime.GOARCH) + return fmt.Errorf("%w.\nPlease ensure that the plugin executable file is compatible with %s/%s and has appropriate permissions.", err, runtime.GOOS, runtime.GOARCH) } var errMalformedPlugin *plugin.PluginMalformedError