mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
add ldConfigPath check
Signed-off-by: rongfu.leng <lenronfu@gmail.com>
This commit is contained in:
parent
f35f3903ab
commit
68f8c27629
@ -128,7 +128,12 @@ func GetDefault() (*Config, error) {
|
||||
}
|
||||
|
||||
func getLdConfigPath() string {
|
||||
return NormalizeLDConfigPath("@/sbin/ldconfig")
|
||||
filePath := "/sbin/ldconfig"
|
||||
fileInfo, err := os.Lstat(filePath)
|
||||
if err != nil || fileInfo.Mode()&os.ModeSymlink != 0 {
|
||||
filePath = "@/sbin/ldconfig"
|
||||
}
|
||||
return NormalizeLDConfigPath(filePath)
|
||||
}
|
||||
|
||||
func getUserGroup() string {
|
||||
|
@ -308,8 +308,9 @@ func TestGetConfig(t *testing.T) {
|
||||
// We first handle the ldconfig path since this is currently system-dependent.
|
||||
if tc.inspectLdconfig {
|
||||
ldconfig := cfg.NVIDIAContainerCLIConfig.Ldconfig
|
||||
require.True(t, strings.HasPrefix(ldconfig, "@/sbin/ldconfig"))
|
||||
remaining := strings.TrimPrefix(ldconfig, "@/sbin/ldconfig")
|
||||
relLdconfig := getLdConfigPath()
|
||||
require.True(t, strings.HasPrefix(ldconfig, relLdconfig))
|
||||
remaining := strings.TrimPrefix(ldconfig, relLdconfig)
|
||||
require.True(t, remaining == ".real" || remaining == "")
|
||||
|
||||
cfg.NVIDIAContainerCLIConfig.Ldconfig = "WAS_CHECKED"
|
||||
|
Loading…
Reference in New Issue
Block a user