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"}, }, }