Skip to content

Commit e04512c

Browse files
committed
test: make config permission check portable
1 parent 6690c90 commit e04512c

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎desktop/config_test.go‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,16 @@ func TestConfigMigratesEarlyDesktopFieldsAndCredentials(t *testing.T) {
105105
t.Fatalf("saved config still contains %q", forbidden)
106106
}
107107
}
108-
info, err := os.Stat(path)
109-
if err != nil {
110-
t.Fatal(err)
111-
}
112-
if info.Mode().Perm()&0o077 != 0 {
113-
t.Fatalf("config permissions are too broad: %o", info.Mode().Perm())
108+
// Windows reports synthetic POSIX mode bits (typically 0666); access is
109+
// controlled by ACLs and cannot be validated through os.FileMode.
110+
if runtime.GOOS != "windows" {
111+
info, err := os.Stat(path)
112+
if err != nil {
113+
t.Fatal(err)
114+
}
115+
if info.Mode().Perm()&0o077 != 0 {
116+
t.Fatalf("config permissions are too broad: %o", info.Mode().Perm())
117+
}
114118
}
115119
}
116120

0 commit comments

Comments
 (0)