This repository was archived by the owner on May 15, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix: harness and cli point to the same binary #55
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,15 +83,11 @@ func HarnessPathInDir(dir string) string { | |
| return filepath.Join(dir, kimchiDevRepo.Binary) | ||
| } | ||
|
|
||
| // ResolveHarnessPath derives the harness binary path from the kimchi executable's | ||
| // resolved directory. For example, if kimchi is at /usr/local/bin/kimchi, this | ||
| // returns /usr/local/bin/kimchi. | ||
| // ResolveHarnessPath returns the path where the harness binary lives. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️🔧 Maintainability The change in 💡 Suggestion: Consider adding migration logic or documentation to clean up the harness binary from the old location (the CLI directory) on first run after upgrade, or log a warning if a harness is detected at the legacy path to guide users to remove it. |
||
| // It is placed inside the harness data directory so it does not collide | ||
| // with the Go CLI binary (both are now named "kimchi" after the merge). | ||
| func ResolveHarnessPath() (string, error) { | ||
| execPath, err := ResolveExecutablePath() | ||
| if err != nil { | ||
| return "", fmt.Errorf("resolve harness path: %w", err) | ||
| } | ||
| return HarnessPathInDir(filepath.Dir(execPath)), nil | ||
| return HarnessPathInDir(filepath.Join(harnessDataDir(), "bin")), nil | ||
| } | ||
|
|
||
| // HarnessInstalled reports whether the harness binary exists at the given path. | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
guardAgainstSelfExecfunction implements file system logic (resolving executable paths,os.Stat,os.SameFile) that is critical for preventing infinite loops, but lacks unit test coverage. Without tests, regressions in path resolution or file comparison logic could allow self-exec scenarios to slip through or incorrectly block valid executions.💡 Suggestion: Add unit tests for
guardAgainstSelfExeccovering: 1) identical paths, 2) different paths pointing to same inode (hard links), 3) symlinks resolving to self, 4) error cases whereResolveExecutablePathoros.Statfail, verifying the function returnsnil(soft failure) as expected.