Repository navigation
fix(macos): support Homebrew installs and find ctrace on PATH #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -235,14 +235,21 @@ elif command -v zypper >/dev/null 2>&1; then | |
| elif command -v apk >/dev/null 2>&1; then | ||
| echo "Detected Alpine Linux (apk)." | ||
| apk add --no-cache cppcheck flawfinder build-base git cmake python3 py3-pip curl || true | ||
| elif command -v brew >/dev/null 2>&1; then | ||
| echo "Detected macOS (Homebrew)." | ||
| # Homebrew refuses to run as root, so install as the invoking user. | ||
| sudo -u "\${SUDO_USER:-$(id -un)}" brew install cppcheck flawfinder cmake python3 || true | ||
|
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.
On a clean macOS installation, this command installs cppcheck, flawfinder, cmake, and Python but never installs IKOS; the later setup only links Useful? React with 👍 / 👎. |
||
| # IKOS is only published through NASA's tap (builds LLVM deps, can take a while). | ||
| sudo -u "\${SUDO_USER:-$(id -un)}" brew install nasa-sw-vnv/core/ikos || true | ||
| else | ||
| echo "Warning: Unrecognized package manager. Please ensure git, g++, make, cmake, python3, and curl are installed." | ||
| fi | ||
|
|
||
| echo "=== [2/5] Creating CoreTrace tools directory structure... ===" | ||
| USER_HOME="$CORETRACE_USER_HOME" | ||
| if [ -z "$USER_HOME" ] && [ -n "$SUDO_USER" ]; then | ||
| USER_HOME=$(getent passwd "$SUDO_USER" | cut -d: -f6) | ||
| # getent does not exist on macOS; tilde expansion works everywhere. | ||
| USER_HOME=$(eval echo "~$SUDO_USER") | ||
| fi | ||
| if [ -z "$USER_HOME" ]; then | ||
| USER_HOME="$HOME" | ||
|
|
@@ -344,7 +351,7 @@ fi | |
| # Ensure permissions | ||
| TOOLS_OWNER="$CORETRACE_USER_NAME" | ||
| if [ -z "$TOOLS_OWNER" ]; then TOOLS_OWNER="$SUDO_USER"; fi | ||
| if [ -n "$TOOLS_OWNER" ]; then chown -R "$TOOLS_OWNER:$TOOLS_OWNER" "$TOOLS_DIR" 2>/dev/null || true; fi | ||
| if [ -n "$TOOLS_OWNER" ]; then chown -R "$TOOLS_OWNER" "$TOOLS_DIR" 2>/dev/null || true; fi | ||
| chmod -R 755 "$TOOLS_DIR" 2>/dev/null || true | ||
|
|
||
| echo "=== All CoreTrace dependencies installed and verified successfully! ===" | ||
|
|
||
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.
When macOS has a working PATH-installed binary but the release response has no Darwin asset, every analysis reaches this fallback only after another GitHub API request. Although line 105 records
coretrace-last-update-check, the earlier throttle applies only whendownloadedBinaryPathexists, so this successful no-asset case is never throttled; each scan incurs network latency and can exhaust the unauthenticated API limit. Reuse the PATH binary while honoring the update interval, or check it before attempting a download.Useful? React with 👍 / 👎.