Skip to content

fix: correctly check mega-evme binary in command existence check#195

Open
Ocheretovich wants to merge 2 commits intomegaeth-labs:mainfrom
Ocheretovich:main
Open

fix: correctly check mega-evme binary in command existence check#195
Ocheretovich wants to merge 2 commits intomegaeth-labs:mainfrom
Ocheretovich:main

Conversation

@Ocheretovich
Copy link

Handle cases where MEGA_EVME includes arguments by checking only the binary name. Prevents false negatives in command existence check


# Check mega-evme binary separately (handle args)
MEGA_EVME_BIN=${MEGA_EVME%% *}
if ! command -v "$MEGA_EVME_BIN" &>/dev/null; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existence check fix is correct here — extracting the binary name via ${MEGA_EVME%% *} handles the case where MEGA_EVME contains arguments.

However, the actual invocation on line 101 still uses "$MEGA_EVME" (double-quoted), which means if MEGA_EVME="mega-evme --some-flag", bash will try to execute the entire string as a single command name rather than splitting it into command + arguments. So the scenario this PR fixes for the existence check would still fail at runtime.

To make this work end-to-end, line 101 should use $MEGA_EVME unquoted (to allow word splitting) or use an array-based approach:

Suggested change
if ! command -v "$MEGA_EVME_BIN" &>/dev/null; then
if ! command -v "$MEGA_EVME_BIN" &>/dev/null; then

And then also change line 101 from "$MEGA_EVME" to $MEGA_EVME (unquoted) so that arguments are properly word-split.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants