ctr: improve error relative shim path error msg

addresses https://github.com/containerd/containerd/issues/6464

Return an error if a runtime provided is relative.

Add context to the usage for `ctr run --runtime` indicating that
absolute path to runtime binary must be provided.

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
This commit is contained in:
Gavin Inglis
2022-02-05 00:55:47 +00:00
parent a9f61ba2c8
commit 7b045ea5f0
4 changed files with 107 additions and 2 deletions

View File

@@ -85,7 +85,7 @@ func Command(ctx context.Context, config *CommandConfig) (*exec.Cmd, error) {
func BinaryName(runtime string) string {
// runtime name should format like $prefix.name.version
parts := strings.Split(runtime, ".")
if len(parts) < 2 {
if len(parts) < 2 || parts[0] == "" {
return ""
}