From 2491fd4e8023e93975b2646cf1031b20895f3f61 Mon Sep 17 00:00:00 2001 From: Nelmad <17722412+Nelmad@users.noreply.github.com> Date: Tue, 27 Oct 2026 01:41:06 +0300 Subject: [PATCH] test(install): exercise copyFrom's same-inode branch Remove the initial destination copy before linking so the fixture does not skip with EEXIST. Check that copyFrom preserves the shared inode, since checking only the returned name also passes after an unnecessary copy. Signed-off-by: Nelmad <17722412+Nelmad@users.noreply.github.com> --- packages/core/install/gobinaries_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/install/gobinaries_test.go b/packages/core/install/gobinaries_test.go index fd6724a..079622e 100644 --- a/packages/core/install/gobinaries_test.go +++ b/packages/core/install/gobinaries_test.go @@ -172,6 +172,9 @@ func TestCopyFromSkipsAlreadyIdenticalBinary(t *testing.T) { } to := filepath.Join(BinDir(), name) + if err := os.Remove(to); err != nil { + t.Fatal(err) + } if err := os.Link(from, to); err != nil { t.Skipf("hard links unsupported here: %v", err) } @@ -186,6 +189,9 @@ func TestCopyFromSkipsAlreadyIdenticalBinary(t *testing.T) { if !found { t.Errorf("copyFrom() with a same-inode destination should still report %q as placed, got %v", name, placed) } + if !sameFile(from, to) { + t.Error("copyFrom() replaced a same-inode destination instead of skipping the copy") + } } func TestInstallGoBinariesCreatesBinDir(t *testing.T) {