mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
[test] handle ModeIrregular in getFilePerm for Go 1.23
This commit is contained in:
parent
b9f6013c12
commit
2a32b21372
@ -77,12 +77,15 @@ func getFilePerm(path string) (os.FileMode, error) {
|
|||||||
// NOTE(claudiub): Symlinks have different permissions which might not match the target's.
|
// NOTE(claudiub): Symlinks have different permissions which might not match the target's.
|
||||||
// We want to evaluate the permissions of the target's not the symlink's.
|
// We want to evaluate the permissions of the target's not the symlink's.
|
||||||
info, err := os.Lstat(path)
|
info, err := os.Lstat(path)
|
||||||
if err == nil && info.Mode()&os.ModeSymlink != 0 {
|
if err == nil {
|
||||||
evaluated, err := filepath.EvalSymlinks(path)
|
// go1.23 behavior change: https://github.com/golang/go/issues/63703#issuecomment-2535941458
|
||||||
if err != nil {
|
if info.Mode()&os.ModeSymlink != 0 || info.Mode()&os.ModeIrregular != 0 {
|
||||||
return 0, err
|
evaluated, err := filepath.EvalSymlinks(path)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
path = evaluated
|
||||||
}
|
}
|
||||||
path = evaluated
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command("powershell.exe", "-NonInteractive", "./filePermissions.ps1",
|
cmd := exec.Command("powershell.exe", "-NonInteractive", "./filePermissions.ps1",
|
||||||
|
Loading…
Reference in New Issue
Block a user