From 4dedac6a246a3bc8bc59ed718834857c1e5175f1 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 29 Sep 2022 12:14:12 +0200 Subject: [PATCH] Use base filename as first hook argument Signed-off-by: Evan Lezar --- internal/discover/ldconfig.go | 2 +- internal/discover/ldconfig_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/discover/ldconfig.go b/internal/discover/ldconfig.go index 7daf8095..af74645d 100644 --- a/internal/discover/ldconfig.go +++ b/internal/discover/ldconfig.go @@ -80,7 +80,7 @@ func CreateLDCacheUpdateHook(logger *logrus.Logger, lookup lookup.Locator, execu } logger.Debugf("Using NVIDIA Container Toolkit CLI path %v", hookPath) - args := []string{hookPath, "hook", "update-ldcache"} + args := []string{filepath.Base(hookPath), "hook", "update-ldcache"} for _, f := range uniqueFolders(libraries) { args = append(args, "--folder", f) } diff --git a/internal/discover/ldconfig_test.go b/internal/discover/ldconfig_test.go index 18de3f85..763aa420 100644 --- a/internal/discover/ldconfig_test.go +++ b/internal/discover/ldconfig_test.go @@ -41,7 +41,7 @@ func TestLDCacheUpdateHook(t *testing.T) { }{ { description: "empty mounts", - expectedArgs: []string{"/usr/bin/nvidia-ctk", "hook", "update-ldcache"}, + expectedArgs: []string{"nvidia-ctk", "hook", "update-ldcache"}, }, { description: "mount error", @@ -64,7 +64,7 @@ func TestLDCacheUpdateHook(t *testing.T) { Path: "/usr/local/lib/libbar.so", }, }, - expectedArgs: []string{"/usr/bin/nvidia-ctk", "hook", "update-ldcache", "--folder", "/usr/local/lib", "--folder", "/usr/local/libother"}, + expectedArgs: []string{"nvidia-ctk", "hook", "update-ldcache", "--folder", "/usr/local/lib", "--folder", "/usr/local/libother"}, }, { description: "host paths are ignored", @@ -74,7 +74,7 @@ func TestLDCacheUpdateHook(t *testing.T) { Path: "/usr/local/lib/libfoo.so", }, }, - expectedArgs: []string{"/usr/bin/nvidia-ctk", "hook", "update-ldcache", "--folder", "/usr/local/lib"}, + expectedArgs: []string{"nvidia-ctk", "hook", "update-ldcache", "--folder", "/usr/local/lib"}, }, }