1
1

Cleanup the passing of MCA params on the orted cmd line in ssh by ensuring that we quote all values since they could be multi-word and/or contain special characters. Thanks to Dirk Schubert for pointing it out.

cmr=v1.8.2:reviewer=jsquyres

This commit was SVN r32280.
Этот коммит содержится в:
Ralph Castain 2014-07-22 18:22:06 +00:00
родитель 408474d2d8
Коммит a94a97bd50

Просмотреть файл

@ -572,11 +572,9 @@ static int setup_launch(int *argcptr, char ***argvptr,
*/ */
cnt = opal_argv_count(orted_cmd_line); cnt = opal_argv_count(orted_cmd_line);
for (i=0; i < cnt; i+=3) { for (i=0; i < cnt; i+=3) {
/* check if the specified option is more than one word - all /* there could be multi-word values here, or
* others have already been passed * values with special characters, so protect
*/ * the value with quotes */
if (NULL != strchr(orted_cmd_line[i+2], ' ')) {
/* must add quotes around it */
(void)asprintf(&param, "\"%s\"", orted_cmd_line[i+2]); (void)asprintf(&param, "\"%s\"", orted_cmd_line[i+2]);
/* now pass it along */ /* now pass it along */
opal_argv_append(&argc, &argv, orted_cmd_line[i]); opal_argv_append(&argc, &argv, orted_cmd_line[i]);
@ -584,7 +582,6 @@ static int setup_launch(int *argcptr, char ***argvptr,
opal_argv_append(&argc, &argv, param); opal_argv_append(&argc, &argv, param);
free(param); free(param);
} }
}
/* unless told otherwise... */ /* unless told otherwise... */
if (mca_plm_rsh_component.pass_environ_mca_params) { if (mca_plm_rsh_component.pass_environ_mca_params) {
@ -612,20 +609,16 @@ static int setup_launch(int *argcptr, char ***argvptr,
} }
} }
if (!found) { if (!found) {
char *p2;
/* add it */ /* add it */
opal_argv_append(&argc, &argv, "-mca"); opal_argv_append(&argc, &argv, "-mca");
opal_argv_append(&argc, &argv, param); opal_argv_append(&argc, &argv, param);
/* if the value has a special character in it, /* there could be multi-word values here, or
* then protect it with quotes * values with special characters, so protect
*/ * the value with quotes */
if (NULL != strchr(value, ';')) {
char *p2;
(void)asprintf(&p2, "\"%s\"", value); (void)asprintf(&p2, "\"%s\"", value);
opal_argv_append(&argc, &argv, p2); opal_argv_append(&argc, &argv, p2);
free(p2); free(p2);
} else {
opal_argv_append(&argc, &argv, value);
}
} }
free(param); free(param);
} }