From 8754de747d9cd1ba9018f568987d4a5d7a87d50e Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 9 Oct 2026 16:48:38 +0200 Subject: [PATCH] messenger: judge the break-glass file's owner by a faked owner both ways, so the test holds under root The build seat runs the suite as root, where every file the test makes is root's, so "a file not made by root" was root's and unlinked (the forge's repo-check of 2026-10-09). The owner is now faked as another account for the refusal and as root for the act; the test fails as before under unshare -r without this. --- modules/messenger/cmd/messenger/answers_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/messenger/cmd/messenger/answers_test.go b/modules/messenger/cmd/messenger/answers_test.go index f14a6903..2a5eed39 100644 --- a/modules/messenger/cmd/messenger/answers_test.go +++ b/modules/messenger/cmd/messenger/answers_test.go @@ -848,6 +848,12 @@ func TestBreakGlassIsAFileRootMadeAndTheMinuteGoesOn(t *testing.T) { t.Fatal("the router's minute hung on a break-glass file") } } + // Who owns the file is what the kernel says, faked here both ways: the build seat runs this suite as root, where + // every file the test makes is root's, and a person runs it as themselves (the forge's check of 2026-10-09 failed + // on the first and passed on the second). + was := fileOwner + t.Cleanup(func() { fileOwner = was }) + fileOwner = func(os.FileInfo) uint32 { return 1000 } if err := os.WriteFile(filepath.Join(h.StateDir, "unlink.telegram"), nil, 0o600); err != nil { t.Fatal(err) } @@ -859,8 +865,6 @@ func TestBreakGlassIsAFileRootMadeAndTheMinuteGoesOn(t *testing.T) { if _, err := h.Unlink("telegram"); err != nil { t.Fatal(err) } - was := fileOwner - t.Cleanup(func() { fileOwner = was }) fileOwner = func(os.FileInfo) uint32 { return 0 } _ = os.WriteFile(filepath.Join(h.StateDir, "unlink.telegram"), nil, 0o600) tick()