Skip to content

Commit

Permalink
Fix OMPI cmd line processing
Browse files Browse the repository at this point in the history
Don't touch provided values of MCA params when
converting single-dash to double-dash options.

Signed-off-by: Ralph Castain <[email protected]>
(cherry picked from commit 0da2000)
  • Loading branch information
rhc54 committed Nov 19, 2023
1 parent dac26b1 commit 9072e6f
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/mca/schizo/ompi/schizo_ompi.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,27 @@ static int setup_app(prte_pmix_app_t *app)
return rc;
}

static bool mcaoption(char *s)
{
size_t len = strlen(s);

if (3 > len) {
return false;
}
if ('a' == s[len-1] &&
'c' == s[len-2] &&
'm' == s[len-3]) {
return true;
}
return false;
}

static int parse_cli(char **argv, pmix_cli_result_t *results,
bool silent)
{
int rc, n;
int rc, m, n;
pmix_cli_item_t *opt;
char *p1;
char *p1, *p2;
char **pargv;

/* backup the argv */
Expand Down Expand Up @@ -439,6 +454,19 @@ static int parse_cli(char **argv, pmix_cli_result_t *results,
if ('-' != pargv[n][0]) {
continue;
}
// if this is an mca spec, then skip it
if (mcaoption(pargv[n])) {
if ('-' != pargv[n][1]) {
// make it a "--" option
p2 = strdup(pargv[n]);
free(pargv[n]);
pmix_asprintf(&pargv[n], "-%s", p2);
free(p2);
}
// now skip the next two positions
n += 2;
continue;
}
/* check for single-dash errors */
if ('-' != pargv[n][1] && 2 < strlen(pargv[n])) {
/* we know this is incorrect */
Expand Down

0 comments on commit 9072e6f

Please sign in to comment.