Repository navigation
test(install): exercise copyFrom's same-inode branch - #166
Merged
codeyevsky merged 1 commit intoOct 26, 2026
Merged
Conversation
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>
codeyevsky
approved these changes
Oct 26, 2026
codeyevsky
left a comment
Member
There was a problem hiding this comment.
Test-only fix: removes the stale destination before the hard-link, asserts same-inode after copyFrom. Verified locally, production code unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #161.
The first
copyFromalready creates the destination, so the followingos.Linkfails withEEXISTand the test skips before reaching its assertion. Remove that copy before creating the hard link.Also assert that the source and destination still refer to the same file after the second
copyFrom. Checking only the returned binary name would still pass if the same-inode branch were removed and the binary were unnecessarily copied again.Only the existing test changes; production code and the fallback for environments without hard-link support are unchanged.
Validation on macOS arm64, Go 1.26.10:
file exists; the same-inode block has coverage count 0. After: the test passes and the block has count 1.go vet ./...passes inpackages/core;go test -count=1 -race ./install/passes all 131 top-level tests without skips../scripts/sg-unit-check.shstopped inguard/shieldbecause the execution sandbox disallows localhost listeners. That package passes when rerun with localhost access and an isolated HOME. The full repository suite was not completed for this change.Linux execution was not repeated locally because the Docker daemon was unavailable. No real-agent integration or installer scripts were run locally: this change only repairs a unit-test fixture, and the tests use temporary files and settings.
Hosted validation subsequently passed for this commit: CI, CodeQL, and Trivy. CI includes all nine Go module jobs, six cross-platform builds, and the integration checks.