Skip to content

Commit 976aefc

Browse files
committed
fix: adopt go1.23 behavior change in mount point parsing on Windows
1 parent 3ec9c7f commit 976aefc

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

staging/src/k8s.io/mount-utils/mount_windows.go

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ func (mounter *Mounter) IsLikelyNotMountPoint(file string) (bool, error) {
242242
if stat.Mode()&os.ModeSymlink != 0 {
243243
return false, err
244244
}
245+
// go1.23 behavior change: https://github.com/golang/go/issues/63703#issuecomment-2535941458
246+
if stat.Mode()&os.ModeIrregular != 0 {
247+
return false, err
248+
}
245249
return true, nil
246250
}
247251

@@ -329,30 +333,3 @@ func ListVolumesOnDisk(diskID string) (volumeIDs []string, err error) {
329333
volumeIds := strings.Split(strings.TrimSpace(string(output)), "\r\n")
330334
return volumeIds, nil
331335
}
332-
333-
// getAllParentLinks walks all symbolic links and return all the parent targets recursively
334-
func getAllParentLinks(path string) ([]string, error) {
335-
const maxIter = 255
336-
links := []string{}
337-
for {
338-
links = append(links, path)
339-
if len(links) > maxIter {
340-
return links, fmt.Errorf("unexpected length of parent links: %v", links)
341-
}
342-
343-
fi, err := os.Lstat(path)
344-
if err != nil {
345-
return links, fmt.Errorf("Lstat: %v", err)
346-
}
347-
if fi.Mode()&os.ModeSymlink == 0 {
348-
break
349-
}
350-
351-
path, err = os.Readlink(path)
352-
if err != nil {
353-
return links, fmt.Errorf("Readlink error: %v", err)
354-
}
355-
}
356-
357-
return links, nil
358-
}

0 commit comments

Comments
 (0)