aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/system/dispatcher_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-10-13 22:58:19 +0900
committerOphestra <cat@gensokyo.uk>2026-10-13 22:58:19 +0900
commitfadb42ec8daeeb8a576582d274cd4aeb64e535c0 (patch)
tree20db92adde637b3d1bc7a931d0551590e80456cf /internal/system/dispatcher_test.go
parent40e4c9031652731622315e778a9bcace6cea6cb3 (diff)
internal/system: skip superfluous chmod
A successful chmod clobbers acl mask, breaking the fast path. This change also fixes the ACL race. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/system/dispatcher_test.go')
-rw-r--r--internal/system/dispatcher_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/system/dispatcher_test.go b/internal/system/dispatcher_test.go
index 6ffd0dfa..dd42b965 100644
--- a/internal/system/dispatcher_test.go
+++ b/internal/system/dispatcher_test.go
@@ -2,11 +2,13 @@ package system
import (
"io"
+ "io/fs"
"log"
"os"
"reflect"
"slices"
"testing"
+ "time"
"unsafe"
"hakurei.app/check"
@@ -215,6 +217,17 @@ type kstub struct{ *stub.Stub[syscallDispatcher] }
func (k *kstub) new(f func(k syscallDispatcher)) { k.Helper(); k.New(f) }
+// modeFi implements the Mode method of [os.FileInfo].
+type modeFi os.FileMode
+
+func (modeFi) Name() string { panic("attempting to call Name") }
+func (modeFi) Size() int64 { panic("attempting to call Size") }
+func (modeFi) ModTime() time.Time { panic("attempting to call ModTime") }
+func (modeFi) Sys() any { panic("attempting to call Sys") }
+
+func (fi modeFi) Mode() fs.FileMode { return fs.FileMode(fi) }
+func (fi modeFi) IsDir() bool { return fs.FileMode(fi).IsDir() }
+
func (k *kstub) stat(name string) (fi os.FileInfo, err error) {
k.Helper()
expect := k.Expects("stat")