mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-25 21:39:10 +00:00
Merge branch 'fix-libraries-cdi' into 'main'
Fix relative link resolution for ldcache See merge request nvidia/container-toolkit/container-toolkit!275
This commit is contained in:
commit
50afd443fc
@ -302,11 +302,14 @@ func (c *ldcache) resolve(target string) (string, error) {
|
||||
return "", fmt.Errorf("failed to resolve symlink: %v", err)
|
||||
}
|
||||
|
||||
if filepath.IsAbs(link) {
|
||||
c.logger.Debugf("Found absolute link %v", link)
|
||||
link = filepath.Join(c.root, link)
|
||||
// We return absolute paths for all targets
|
||||
if !filepath.IsAbs(link) || strings.HasPrefix(link, ".") {
|
||||
link = filepath.Join(filepath.Dir(target), link)
|
||||
}
|
||||
|
||||
// Ensure that the returned path is relative to the root.
|
||||
link = filepath.Join(c.root, link)
|
||||
|
||||
c.logger.Debugf("Resolved link: '%v' => '%v'", name, link)
|
||||
return link, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user